-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activate the extension automatically #344
Activate the extension automatically #344
Conversation
It might be better using the |
222afcf
to
ee51c51
Compare
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.
ee51c51
to
18b3af3
Compare
Based on comments like #72 (comment)
I was initially unsure, whether such a But reading that thread again, I now think that the comment was about opening a folder somewhere in the folder hierarchy between two I updated the pull request to use |
@@ -17,16 +17,11 @@ | |||
"Programming Languages" | |||
], | |||
"activationEvents": [ | |||
"onLanguage:starlark", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep onLanguage:starlark
, on the off chance case someone opens a .bzl
file in a workspace without any of the other workspaceContains
triggers. Doesn't hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to VS Code's documentation, the onLanguage:starlark
activation event is unnecessary:
Beginning with VS Code 1.74.0, languages contributed by your extension do not require a corresponding onLanguage activation event declaration for your extension to be activated.
Note that this extension only support VSCode >= 1.85.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the description of this PR to also include the reasoning on why I removed all pre-existing activation events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks, sounds good!
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:
bazelWorkspace
view is only shown when thevscodeBazelHaveBazelWorkspace
context variable is set.hidden initially.
the extension was activated.
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.
Furthermore, all pre-existing activation events were redundant since
VS Code 1.74 which started to automatically infer activation events
based on the contributions provided by an extension
BEGIN_COMMIT_OVERRIDE
fix: Activate the extension automatically (#344)
END_COMMIT_OVERRIDE