Skip to content

Commit

Permalink
chore: activate extension on command (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato authored Feb 20, 2021
1 parent c4e4542 commit 8ae870c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export async function activate(
context.subscriptions.push(client.start());
tsApi = await getTsApi();
await client.onReady();
vscode.commands.executeCommand("setContext", "deno:lspReady", true);
const serverVersion =
(client.initializeResult?.serverInfo?.version ?? "").split(" ")[0];
statusBarItem.text = `Deno ${serverVersion}`;
Expand All @@ -173,7 +174,9 @@ export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
return client.stop().then(() => {
vscode.commands.executeCommand("setContext", "deno:lspReady", false);
});
}

function showWelcomePage(context: vscode.ExtensionContext) {
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"onLanguage:typescriptreact",
"onLanguage:javascript",
"onLanguage:javascriptreact",
"onCommand:deno.cache",
"onCommand:deno.status",
"onCommand:deno.welcome",
"onCommand:deno.initializeWorkspace",
"onWebviewPanel:welcomeDeno"
],
"main": "./client/out/extension",
Expand All @@ -46,7 +46,8 @@
"command": "deno.cache",
"title": "Cache Dependencies",
"category": "Deno",
"description": "Cache the active workspace document and its dependencies."
"description": "Cache the active workspace document and its dependencies.",
"enablement": "deno:lspReady"
},
{
"command": "deno.initializeWorkspace",
Expand All @@ -58,7 +59,8 @@
"command": "deno.status",
"title": "Language Server Status",
"category": "Deno",
"description": "Provide a status document of the language server."
"description": "Provide a status document of the language server.",
"enablement": "deno:lspReady"
},
{
"command": "deno.welcome",
Expand Down

0 comments on commit 8ae870c

Please sign in to comment.