Unnamed repository; edit this file 'description' to name the repository.
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.
Elias Holzmann 2023-10-08
parent b1f89a8 · commit 3dfc1bf
-rw-r--r--editors/code/src/commands.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 245557b1e8..5e60251060 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));
}
};
}