From 3dfc1bfc67c9779ec3c936c1987349ac77cd8af4 Mon Sep 17 00:00:00 2001 From: Elias Holzmann <9659253+EliasHolzmann@users.noreply.github.com> Date: Sun, 8 Oct 2023 03:31:23 +0200 Subject: [PATCH] Use vscode.env.openExternal instead of the vscode.open command for docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- editors/code/src/commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 245557b1e88..5e602510601 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -950,7 +950,7 @@ export function openDocs(ctx: CtxInit): Cmd { const doclink = await client.sendRequest(ra.openDocs, { position, textDocument }); if (doclink != null) { - await vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink)); + await vscode.env.openExternal(vscode.Uri.parse(doclink)); } }; }