Skip to content

Consider keybinding platform context keys on start up #85058

@Tyriar

Description

@Tyriar

I have these keybindings

{ "key": "ctrl+n",           "command": "explorer.newFile", "when": "explorerViewletVisible && filesExplorerFocus && !isMac" },
{ "key": "cmd+n",            "command": "explorer.newFile", "when": "explorerViewletVisible && filesExplorerFocus && isMac" },
{ "key": "ctrl+shift+n",     "command": "explorer.newFolder", "when": "explorerViewletVisible && filesExplorerFocus && !isMac" },
{ "key": "cmd+shift+n",      "command": "explorer.newFolder", "when": "explorerViewletVisible && filesExplorerFocus && isMac" },

{ "key": "cmd+q",            "command": "-workbench.action.quit", "when": "isMac" },
{ "key": "cmd+q cmd+q",      "command": "workbench.action.quit", "when": "isMac" }

Which end up showing the keybindings in menus since contexts are not considered here.

image
image

Maybe we could refine the when clause just for startup to ignore all entries except for isMac, isWindows and isLinux? For example:

explorerViewletVisible && filesExplorerFocus && !isMac
= (true) && (true) && !isMac
= !isMac

For or queries we can just assume everything is true?

terminalFocus && isWindows || terminalFocus && isLinux || filesExplorerFocus
= (true) && isWindows || (true) && isLinux || (true)
= isWindows || isLinux || true
= true

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions