Skip to content

Commit

Permalink
fix: register commands before starting language server (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Jan 29, 2024
1 parent 5c1255c commit 13855f8
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,15 @@ export async function activate(
}
}));

await commands.startLanguageServer(context, extensionContext)();

// Register any commands.
const registerCommand = createRegisterCommand(context);
const builtinCommands = await vscode.commands.getCommands();
// TODO(nayeemrmn): Change the LSP's invocations of this to
// `deno.client.showReferences`. Remove this one eventually.
if (!builtinCommands.includes("deno.showReferences")) {
registerCommand("deno.showReferences", commands.showReferences);
}
registerCommand("deno.client.showReferences", commands.showReferences);
// TODO(nayeemrmn): Change the LSP's invocations of this to
// `deno.client.test`. Remove this one eventually.
if (!builtinCommands.includes("deno.test")) {
registerCommand("deno.test", commands.test);
}
// TODO(nayeemrmn): LSP versions <= 1.40.2 use this alias. Remove it
// eventually.
registerCommand("deno.showReferences", commands.showReferences);
registerCommand("deno.client.test", commands.test);
// TODO(nayeemrmn): LSP versions <= 1.40.2 use this alias. Remove it
// eventually.
registerCommand("deno.test", commands.test);
registerCommand(
"deno.client.cacheActiveDocument",
commands.cacheActiveDocument,
Expand All @@ -226,6 +218,8 @@ export async function activate(
registerCommand("deno.client.enable", commands.enable);
registerCommand("deno.client.disable", commands.disable);
registerCommand("deno.client.statusBarClicked", commands.statusBarClicked);

await commands.startLanguageServer(context, extensionContext)();
}

export function deactivate(): Thenable<void> | undefined {
Expand Down

0 comments on commit 13855f8

Please sign in to comment.