support active/focused view or panel when
clause context
#6062
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
when
clause contextSee https://code.visualstudio.com/docs/getstarted/keybindings#_activefocused-view-or-panel-when-clause-context for requirements. Important: in this context active means visible, not focused as usual.
In VS Code there are viewlets, panels and views:
Important difference to Theia that VS Code does not allow to move individual viewlets or panels to other areas. It means that there is always only one visible viewlet or panel in VS Code, but in Theia it can be that several viewlets and panels widgets are visible. This PR implements the difference by setting context keys to last focused visible viewlet or panel widget.
How to test
activeViewlet
andactivePanel
: open quick command palette and typeTest
you should see commands visible in the current context https://github.com/akosyakov/vscode-view-when-sample/blob/dd61713e5124d10e744d02d0694f177b3d46af3f/package.json#L69-L109focusedView
: focus contributednodeDependencies
view in the explorer tab and typectrlcmd+f1
, it should trigger a notification bound to this keybinding when this view is focused: https://github.com/akosyakov/vscode-view-when-sample/blob/dd61713e5124d10e744d02d0694f177b3d46af3f/package.json#L112-L118Review checklist
Reminder for reviewers