简体   繁体   English

多个命令(快捷方式)的相同键绑定 vscode

[英]Same keybind for multiple commands (shortcuts) vscode

I'm trying to have the same command for multiple actions on vscode like run/stop on .py , same on a notebook, but when I add the cmd+enter keybind for one shortcut, the other stops working.我试图对 vscode 上的多个操作使用相同的命令,例如在.py上运行/停止,在笔记本上也是如此,但是当我为一个快捷方式添加cmd+enter键绑定时,另一个停止工作。 I found it pretty random, sometimes it works sometimes not, yesterday it worked and I just opened my project, didn't work...我发现它很随机,有时它工作有时不工作,昨天它工作了,我刚刚打开我的项目,没有工作......

I've checked the JSON files Default Keyboard Shortcuts (JSON) and Keyboard Shortcuts (JSON) but everything seems to be fine.我检查了JSON文件Default Keyboard Shortcuts (JSON)Keyboard Shortcuts (JSON)但一切似乎都很好。

Anyone that went through a similar experience or has a fix?有过类似经历或有解决办法的吗?

Secondary shortcut may not work because in the json file Keyboard Shortcuts (JSON) , when setting a new shortcut, you have a condition where .辅助快捷方式可能不起作用,因为在 json 文件Keyboard Shortcuts (JSON)中,设置新快捷方式时,您有一个条件where .

This file is the user keybind file and will store all the shortcuts you set or remove.此文件是用户键绑定文件,将存储您设置或删除的所有快捷方式。 For the removed ones (the default that you change), they have a minus in front of the command name.对于已删除的(您更改的默认值),它们在命令名称前有一个减号。

To set a new shortcut you need to specify the when.要设置新的快捷方式,您需要指定何时。

{
    "key": "cmd+enter",
    "command": "workbench.action.debug.stop",
    "when": "!notebookEditorFocused && inDebugMode"
},
{
    "key": "shift+f5",
    "command": "-workbench.action.debug.stop",
    "when": "inDebugMode && !focusedSessionIsAttach"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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