Skip to content

Commit

Permalink
Activate the extension automatically
Browse files Browse the repository at this point in the history
So far, the `bazelWorkspace` view, listing the available build targets,
was only shown after running the first Bazel command, e.g., through
the command pallete. This behavior was probably unintended and is rather
cumbersome for people which want to inspect the available Bazel targets.

The chain of events which lead to this behavior are:
* The `bazelWorkspace` view is only shown when the
  `vscodeBazelHaveBazelWorkspace` context variable is set.
* This context variable is unset by default, and hence the view is
  hidden initially.
* As soon as the first Bazel command is run from the command pallete,
  the extension was activated.
* As part of activating, the extension detected that there is in fact
  a Bazel workspace and hence it set the `vscodeBazelHaveBazelWorkspace`
  context variable, unhiding the `bazelWorkspace` view.

This commit fixes the issue by activating the extension as soon as one
of Bazel's build files is found.
  • Loading branch information
vogelsgesang committed Feb 27, 2024
1 parent 995229b commit 18b3af3
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@
"Programming Languages"
],
"activationEvents": [
"onLanguage:starlark",
"onView:bazelWorkspace",
"onCommand:bazel.refreshBazelBuildTargets",
"onCommand:bazel.getTargetOutput",
"onCommand:bazel.info.bazel-bin",
"onCommand:bazel.info.bazel-genfiles",
"onCommand:bazel.info.bazel-testlogs",
"onCommand:bazel.info.execution_root",
"onCommand:bazel.info.output_base",
"onCommand:bazel.info.output_path"
"workspaceContains:**/BUILD",
"workspaceContains:**/WORKSPACE",
"workspaceContains:**/WORKSPACE.bazel",
"workspaceContains:**/MODULE.bazel",
"workspaceContains:**/REPO.bazel"
],
"main": "./out/src/extension/extension",
"contributes": {
Expand Down Expand Up @@ -475,4 +470,4 @@
"vscode-uri": "^3.0.2",
"which": "^4.0.0"
}
}
}

0 comments on commit 18b3af3

Please sign in to comment.