Skip to content

Commit 73b3432

Browse files
committed
Add ability to continue desktop edit session in vscode.dev
1 parent 425a6de commit 73b3432

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

extensions/github/package.json

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
}
2727
},
2828
"enabledApiProposals": [
29-
"contribShareMenu"
29+
"contribShareMenu",
30+
"contribEditSessions"
3031
],
3132
"contributes": {
3233
"commands": [
@@ -37,10 +38,20 @@
3738
{
3839
"command": "github.copyVscodeDevLink",
3940
"title": "Copy vscode.dev Link"
40-
},
41-
{
42-
"command": "github.copyVscodeDevLinkFile",
43-
"title": "Copy vscode.dev Link"
41+
},
42+
{
43+
"command": "github.copyVscodeDevLinkFile",
44+
"title": "Copy vscode.dev Link"
45+
},
46+
{
47+
"command": "github.openOnVscodeDev",
48+
"title": "Open on vscode.dev"
49+
}
50+
],
51+
"continueEditSession": [
52+
{
53+
"command": "github.openOnVscodeDev",
54+
"when": "github.hasGitHubRepo"
4455
}
4556
],
4657
"menus": {
@@ -56,6 +67,10 @@
5667
{
5768
"command": "github.copyVscodeDevLinkFile",
5869
"when": "false"
70+
},
71+
{
72+
"command": "github.openOnVscodeDev",
73+
"when": "false"
5974
}
6075
],
6176
"file/share": [

extensions/github/src/commands.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean) {
2020
}
2121
}
2222

23+
async function openVscodeDevLink(gitAPI: GitAPI): Promise<vscode.Uri | undefined> {
24+
try {
25+
const permalink = getPermalink(gitAPI, true, 'https://vscode.dev/github');
26+
return permalink ? vscode.Uri.parse(permalink) : undefined;
27+
} catch (err) {
28+
vscode.window.showErrorMessage(err.message);
29+
return undefined;
30+
}
31+
}
32+
2333
export function registerCommands(gitAPI: GitAPI): vscode.Disposable {
2434
const disposables = new DisposableStore();
2535

@@ -39,5 +49,9 @@ export function registerCommands(gitAPI: GitAPI): vscode.Disposable {
3949
return copyVscodeDevLink(gitAPI, false);
4050
}));
4151

52+
disposables.add(vscode.commands.registerCommand('github.openOnVscodeDev', async () => {
53+
return openVscodeDevLink(gitAPI);
54+
}));
55+
4256
return disposables;
4357
}

0 commit comments

Comments
 (0)