Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a OpenURL command for the language server #75

Merged
merged 1 commit into from
Mar 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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