Skip to content

Commit 623ff37

Browse files
committed
Provide a OpenURL command for the language server
This is required to solve prometheus-community/promql-langserver#161 Signed-off-by: Tobias Guggenmos <[email protected]>
1 parent 4d67423 commit 623ff37

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/extension.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ export async function activate(context: vscode.ExtensionContext) {
3535
console.log('Server Command: ', serverPath);
3636
console.log('Server Config: ', serverConfig);
3737

38+
const openURLCommandHandler = (URL: string) => {
39+
// This is a hack to avoid double encoding URL query params
40+
// see https://github.com/microsoft/vscode/issues/85930#issuecomment-821882174
41+
// @ts-ignore
42+
vscode.env.openExternal(URL);
43+
};
3844

45+
context.subscriptions.push(vscode.commands.registerCommand("vscode-promql.openURL", openURLCommandHandler))
3946
const stderrOutputChannel: vscode.OutputChannel = {
4047
name: 'stderr',
4148
// Only append the logs but send them later
@@ -136,7 +143,7 @@ function downloadLangserver(context: vscode.ExtensionContext, callback: any) {
136143
});
137144

138145
stream.on('error', function (err) {
139-
console.log("Failed to download langserver:");
146+
console.log("Failed to download langserver:");
140147
console.log(err);
141148
})
142149
});

0 commit comments

Comments
 (0)