Skip to content

Commit 3dfc1bf

Browse files
committed
Use vscode.env.openExternal instead of the vscode.open command for docs
According to the VS Code documentation, the vscode.open command opens the URL _in the editor_ (https://code.visualstudio.com/api/references/commands). However, in reality, it seems to do so only for file:// URLs, falling back to other applications for other URL schemes (at least for HTTP/HTTPS). Until now, the URL to the documentation was always HTTP based, so using the vscode.open command was perfectly fine. However, displaying local documentation will be supported from now on (see next commit). Local documentation is not HTTP-based, but instead addressed via a file:// URL. The file URL would therefore be opened in VS Code instead of in the browser — this is definitely not what the user wants. Therefore, the vscode.env.openExternal function is used instead, this function never opens the URL in VS Code.
1 parent b1f89a8 commit 3dfc1bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

editors/code/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ export function openDocs(ctx: CtxInit): Cmd {
950950
const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
951951

952952
if (doclink != null) {
953-
await vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink));
953+
await vscode.env.openExternal(vscode.Uri.parse(doclink));
954954
}
955955
};
956956
}

0 commit comments

Comments
 (0)