简体   繁体   中英

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.

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

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

and in the GUI use editorLangId == 'python'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM