Skip to content

Commit

Permalink
Provide a OpenURL command for the language server
Browse files Browse the repository at this point in the history
This is required to solve prometheus-community/promql-langserver#161

Signed-off-by: Tobias Guggenmos <[email protected]>
  • Loading branch information
slrtbtfs committed Mar 26, 2022
1 parent 4d67423 commit 623ff37
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
})
});
Expand Down

0 comments on commit 623ff37

Please sign in to comment.