Bearded Beaver
Bearded Beaver

Reputation: 656

VSCode how to set "when" in keyboard shortcuts tab

More specifiaclly I need VSCode to "run python file in terminal" on Ctrl+R if .py file is opened, or perform a build task otherwise. There is a "when" field in keyboard shortcuts menu but I can't figure out how to set it properly for my case.

Upvotes: 0

Views: 77

Answers (1)

rioV8
rioV8

Reputation: 28783

You can specify the languageId in the keybindings.json file when clause.

"when": "editorLangId == 'python'"

and in the GUI use editorLangId == 'python'

Upvotes: 2

Related Questions