Vscode-docs: Documentation for the keybinding when condition

Created on 13 Oct 2016  路  7Comments  路  Source: microsoft/vscode-docs

Is there some complete list of what conditions are available for the _when_ option in regards to keybindings?

There is the default keybindings.json file but it doesn't explain much.

Most helpful comment

If I wanted to see the exhaustive list of when-contexts for keybindings where would I look?
Is there a command analogous to vscode.commands.getCommands() that I could use to get all valid context properties?
Thanks!

All 7 comments

There is documentation at http://code.visualstudio.com/docs/customization/keybindings#_when-clause-contexts.
There is also an open issue to add when clause IntelliSense (suggestions). Feel free to vote up that issue (thumbs up) if you think that would be useful.

@gregvanl Thank you. I missed that but the list doesn't seem exhaustive. There are multiple _config.x_ that's not listed and for example the _editorHasCompletionItemProvider_.

@krokofant Yes, I opted not to be exhaustive and left out those _when_ clause items that are specific to VS Code UI shortcuts. I didn't think users would want to override those key bindings and it would have made the list too long.
If you see a missing _when_ clause that you think would be useful in a common scenario, please enter an issue and we'll update the list.

Oops I forgot to link to the vscode product issue to offer _when_ clause IntelliSense https://github.com/Microsoft/vscode/issues/9303 in case you want to vote it up.

@gregvanl I see. Personally it left me thinking what else interesting options where excluded as I first viewed the default keybindings.json as a reference.

If I wanted to see the exhaustive list of when-contexts for keybindings where would I look?
Is there a command analogous to vscode.commands.getCommands() that I could use to get all valid context properties?
Thanks!

For example it could be useful to have a key binding active only when on the edito and the file is saved (or need to be saved). Is it possible to check this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanKok picture JanKok  路  4Comments

isidorn picture isidorn  路  5Comments

tariqawni picture tariqawni  路  5Comments

jrieken picture jrieken  路  4Comments

gitdudek picture gitdudek  路  7Comments