Ops
Command Enablement / When Clause Gotchas
Boolean expressions don't support parentheses
whenclause boolean expressions currently do not support parentheses.- See this issue
- You will need to simplify the expression so that it is equivalent and has no parentheses.
editorFocus clause is mostly redundant for command palette enablement
- The context
editorFocusis set when the focus is set to the editor. - When the command palette is brought up, naturally the focus is set to the command palette and
editorFocuswill be unset- You can check this by using
Developer: Toggle Developer Tools, andDeveloper: Inspect Context Keysand inspecting the command palette.
- You can check this by using
- As a result, checking for
!editorFocusis redundant, and checking foreditorFocusis wrong since it will always be false. editorFocusis mostly useful when:- setting enablement clauses for keybindings, or
- in rare cases like the lookup tab auto-complete command where you are specifically guarding against enabling this feature in certain parts of VSCode.
Backlinks