mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Ask user to commit/push changes when copying links (#185802)
* Ask user to commit/push changes when copying links * Don't show an error message for cancellation errors
This commit is contained in:
@@ -11,21 +11,25 @@ import { LinkContext, getLink, getVscodeDevHost } from './links';
|
||||
|
||||
async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean, context: LinkContext, includeRange = true) {
|
||||
try {
|
||||
const permalink = getLink(gitAPI, useSelection, getVscodeDevHost(), 'headlink', context, includeRange);
|
||||
const permalink = await getLink(gitAPI, useSelection, getVscodeDevHost(), 'headlink', context, includeRange);
|
||||
if (permalink) {
|
||||
return vscode.env.clipboard.writeText(permalink);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
if (!(err instanceof vscode.CancellationError)) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function openVscodeDevLink(gitAPI: GitAPI): Promise<vscode.Uri | undefined> {
|
||||
try {
|
||||
const headlink = getLink(gitAPI, true, getVscodeDevHost(), 'headlink');
|
||||
const headlink = await getLink(gitAPI, true, getVscodeDevHost(), 'headlink');
|
||||
return headlink ? vscode.Uri.parse(headlink) : undefined;
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
if (!(err instanceof vscode.CancellationError)) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user