From 623ff375c77b636f9c4c879410b31f18a0cf320b Mon Sep 17 00:00:00 2001 From: Tobias Guggenmos Date: Sat, 26 Mar 2022 04:18:53 +0100 Subject: [PATCH] Provide a OpenURL command for the language server This is required to solve prometheus-community/promql-langserver#161 Signed-off-by: Tobias Guggenmos --- src/extension.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 0933b31..f9133cc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -35,7 +35,14 @@ export async function activate(context: vscode.ExtensionContext) { console.log('Server Command: ', serverPath); console.log('Server Config: ', serverConfig); + const openURLCommandHandler = (URL: string) => { + // This is a hack to avoid double encoding URL query params + // see https://github.com/microsoft/vscode/issues/85930#issuecomment-821882174 + // @ts-ignore + vscode.env.openExternal(URL); + }; + context.subscriptions.push(vscode.commands.registerCommand("vscode-promql.openURL", openURLCommandHandler)) const stderrOutputChannel: vscode.OutputChannel = { name: 'stderr', // Only append the logs but send them later @@ -136,7 +143,7 @@ function downloadLangserver(context: vscode.ExtensionContext, callback: any) { }); stream.on('error', function (err) { - console.log("Failed to download langserver:"); + console.log("Failed to download langserver:"); console.log(err); }) });