mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 13:03:42 +01:00
Share link from File Menu shouldn't include active file (#153911)
Fixes #153537
This commit is contained in:
@@ -9,6 +9,17 @@ import { publishRepository } from './publish';
|
||||
import { DisposableStore } from './util';
|
||||
import { getPermalink } from './links';
|
||||
|
||||
async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean) {
|
||||
try {
|
||||
const permalink = getPermalink(gitAPI, useSelection, 'https://vscode.dev/github');
|
||||
if (permalink) {
|
||||
return vscode.env.clipboard.writeText(permalink);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
export function registerCommands(gitAPI: GitAPI): vscode.Disposable {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
@@ -21,14 +32,11 @@ export function registerCommands(gitAPI: GitAPI): vscode.Disposable {
|
||||
}));
|
||||
|
||||
disposables.add(vscode.commands.registerCommand('github.copyVscodeDevLink', async () => {
|
||||
try {
|
||||
const permalink = getPermalink(gitAPI, 'https://vscode.dev/github');
|
||||
if (permalink) {
|
||||
vscode.env.clipboard.writeText(permalink);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
}
|
||||
return copyVscodeDevLink(gitAPI, true);
|
||||
}));
|
||||
|
||||
disposables.add(vscode.commands.registerCommand('github.copyVscodeDevLinkFile', async () => {
|
||||
return copyVscodeDevLink(gitAPI, false);
|
||||
}));
|
||||
|
||||
return disposables;
|
||||
|
||||
Reference in New Issue
Block a user