mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Add ability to continue desktop edit session in vscode.dev
This commit is contained in:
parent
425a6dec81
commit
73b34320c1
|
@ -26,7 +26,8 @@
|
|||
}
|
||||
},
|
||||
"enabledApiProposals": [
|
||||
"contribShareMenu"
|
||||
"contribShareMenu",
|
||||
"contribEditSessions"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
|
@ -37,10 +38,20 @@
|
|||
{
|
||||
"command": "github.copyVscodeDevLink",
|
||||
"title": "Copy vscode.dev Link"
|
||||
},
|
||||
{
|
||||
"command": "github.copyVscodeDevLinkFile",
|
||||
"title": "Copy vscode.dev Link"
|
||||
},
|
||||
{
|
||||
"command": "github.copyVscodeDevLinkFile",
|
||||
"title": "Copy vscode.dev Link"
|
||||
},
|
||||
{
|
||||
"command": "github.openOnVscodeDev",
|
||||
"title": "Open on vscode.dev"
|
||||
}
|
||||
],
|
||||
"continueEditSession": [
|
||||
{
|
||||
"command": "github.openOnVscodeDev",
|
||||
"when": "github.hasGitHubRepo"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
@ -56,6 +67,10 @@
|
|||
{
|
||||
"command": "github.copyVscodeDevLinkFile",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "github.openOnVscodeDev",
|
||||
"when": "false"
|
||||
}
|
||||
],
|
||||
"file/share": [
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue