diff options
Diffstat (limited to 'extensions/github/src/commands.ts')
-rw-r--r-- | extensions/github/src/commands.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/extensions/github/src/commands.ts b/extensions/github/src/commands.ts index 8c68f36bfc6..40a6927146d 100644 --- a/extensions/github/src/commands.ts +++ b/extensions/github/src/commands.ts @@ -20,6 +20,16 @@ async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean) { } } +async function openVscodeDevLink(gitAPI: GitAPI): Promise<vscode.Uri | undefined> { + try { + const permalink = getPermalink(gitAPI, true, 'https://vscode.dev/github'); + return permalink ? vscode.Uri.parse(permalink) : undefined; + } catch (err) { + vscode.window.showErrorMessage(err.message); + return undefined; + } +} + export function registerCommands(gitAPI: GitAPI): vscode.Disposable { const disposables = new DisposableStore(); @@ -39,5 +49,9 @@ export function registerCommands(gitAPI: GitAPI): vscode.Disposable { return copyVscodeDevLink(gitAPI, false); })); + disposables.add(vscode.commands.registerCommand('github.openOnVscodeDev', async () => { + return openVscodeDevLink(gitAPI); + })); + return disposables; } |