-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[vscode] parse view contribution "when" clause context #6068
Conversation
@vinokurig It looks like a proper solution. 👍 I will test a bit later today. |
@azatsarynnyy Could you check with vscode github extension please? I never was able to configure it properly. I will check that other extensions are still working. |
Sure. I'll check it. |
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.
It does now work for json outline sample extension: https://github.com/microsoft/vscode-extension-samples/tree/master/tree-view-sample
Signed-off-by: Igor Vinokur <[email protected]>
Looks like this controls the |
@vinokurig it should be contributed by the sample extension, but it only appears when json file is opened and should disappear when it is closed |
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.
JSON outline works well now and the solution is better than what was before
I could not test whether it resolves the original issue though with github PR extension. @vinokurig please rely on @azatsarynnyy for it
It fixes the issue with GH PR extension. |
What it does
There is an
affects()
function of theContextKeyChangeEvent
: https://github.com/theia-ide/theia/blob/b0d8292226e4ca179ed6cfa8be4e47e354ff9f61/packages/core/src/browser/context-key-service.ts#L34-L36which evaluates if the given set of context keys has a context key that was changed.
PluginViewRegistry
listens to this event and passeswhen
clause context from the view contribution:https://github.com/theia-ide/theia/blob/b0d8292226e4ca179ed6cfa8be4e47e354ff9f61/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts#L144
The
when
clause context from the view contribution is a string which may be a composed expression e.g."when": "!config.githubPullRequests.showInSCM && config.git.enabled"
: https://github.com/microsoft/vscode-pull-request-github/blob/d91e778705cd5af0785c5a05184ebc550334b409/package.json#L182A map with parsed
when
clauses was introduced to pass separate context keys to theaffects()
function of theContextKeyChangeEvent
.fixes #6015
How to test
git
fromtheia/examples/browser/package.json
.plugins
folder in Theia's root and paste the plugin to it.Without this fix the GitHub panel is empty,
Review checklist
Reminder for reviewers