From 8ae870cc5aff6a62109e7a732aeeb680d0f691dc Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sat, 20 Feb 2021 03:58:24 +0100 Subject: [PATCH] chore: activate extension on command (#336) --- client/src/extension.ts | 5 ++++- package.json | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/extension.ts b/client/src/extension.ts index 57c3383f..1d77cc40 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -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}`; @@ -173,7 +174,9 @@ export function deactivate(): Thenable | undefined { if (!client) { return undefined; } - return client.stop(); + return client.stop().then(() => { + vscode.commands.executeCommand("setContext", "deno:lspReady", false); + }); } function showWelcomePage(context: vscode.ExtensionContext) { diff --git a/package.json b/package.json index 1bd14862..a6f432f1 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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",