Skip to content

Commit 00e3d50

Browse files
use vscode.env.openExternal to view data file on github (#108)
1 parent 32eb645 commit 00e3d50

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

β€Žsrc/commands/viewCommands.tsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ export const enum ViewCommands {
1414
// built-in vscode commands
1515
setContext = 'setContext',
1616
vscodeOpen = 'vscode.open',
17-
vscodeOpenExternal = 'vscode.openExternal',
1817
workbenchOpenSettings = 'workbench.action.openSettings',
1918
}

β€Žsrc/commands/viewDataFileOnGitHub.tsβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
commands,
3+
env,
34
Disposable,
45
ExtensionContext,
56
Uri
@@ -20,9 +21,9 @@ export async function registerViewDataFileOnGitHubCommand(context: ExtensionCont
2021
const viewDataFileOnGitHubCommand: Disposable =
2122
commands.registerCommand(ViewCommands.viewDataFileOnGithub, () => {
2223
const dataFileUri: Uri | undefined = TableView.currentView?.documentUri;
23-
if (dataFileUri && dataFileUri.authority === 'raw.githubuserconent.com') {
24-
commands.executeCommand(ViewCommands.vscodeOpenExternal,
25-
Uri.parse(fileUtils.convertToGitHubRepositoryUrl(dataFileUri.toString(true)))); // skip encoding
24+
if (dataFileUri && dataFileUri.authority === 'raw.githubusercontent.com') {
25+
env.openExternal(Uri.parse(
26+
fileUtils.convertToGitHubRepositoryUrl(dataFileUri.toString(true)))); // skip encoding
2627
}
2728
});
2829
context.subscriptions.push(viewDataFileOnGitHubCommand);

0 commit comments

Comments
Β (0)