0

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. 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.

Anyone that went through a similar experience or has a fix?

rioV8
  • 24,506
  • 3
  • 32
  • 49
Marc
  • 522
  • 1
  • 5
  • 15

1 Answers1

0

Secondary shortcut may not work because in the json file Keyboard Shortcuts (JSON), when setting a new shortcut, you have a condition 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"
}
Marc
  • 522
  • 1
  • 5
  • 15