diff --git a/package.json b/package.json index 0ac93834..39d8afd3 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,8 @@ { "category": "Bazel", "command": "bazel.lsp.restart", - "title": "Restart language server" + "title": "Restart language server", + "when": "bazel.lsp.enabled" } ], "configuration": { @@ -309,39 +310,39 @@ }, { "command": "bazel.buildTarget", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.buildTargetWithDebugging", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.buildAll", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.buildAllRecursive", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.runTarget", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.testTarget", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.testAll", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.testAllRecursive", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" }, { "command": "bazel.clean", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" } ], "view/item/context": [ @@ -438,7 +439,7 @@ { "id": "bazelWorkspace", "name": "Bazel Build Targets", - "when": "vscodeBazelHaveBazelWorkspace" + "when": "bazel.haveWorkspace" } ] } diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 147a6bc7..2e4e0c85 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -95,6 +95,8 @@ export async function activate(context: vscode.ExtensionContext) { ), ); } + // eslint-disable-next-line @typescript-eslint/no-floating-promises + vscode.commands.executeCommand("setContext", "bazel.lsp.enabled", lspEnabled); context.subscriptions.push( vscode.window.registerTreeDataProvider( diff --git a/src/workspace-tree/bazel_workspace_tree_provider.ts b/src/workspace-tree/bazel_workspace_tree_provider.ts index b283147a..b4968e3c 100644 --- a/src/workspace-tree/bazel_workspace_tree_provider.ts +++ b/src/workspace-tree/bazel_workspace_tree_provider.ts @@ -151,7 +151,7 @@ export class BazelWorkspaceTreeProvider // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.commands.executeCommand( "setContext", - "vscodeBazelHaveBazelWorkspace", + "bazel.haveWorkspace", haveBazelWorkspace, ); }