Home > Back-end >  VisualStudio Code shortcut key for switching debugging task
VisualStudio Code shortcut key for switching debugging task

Time:02-25

Is there a keyboard shortcut (or combination of keystrokes) that would let me switch tasks on this toolbar in VS Code?

enter image description here

or this one?

enter image description here

Alternatively, is there a better workflow for debugging shared client/server code that requires two debugging sessions than doing it all in one view?

CodePudding user response:

I don't think there is an easy way to switch debug sessions by keystroke yet. See UI Issues with two simultaneous client/server debug sessions, switching debug sessions: issue is a backlog candidate, upvote it. Also https://github.com/microsoft/vscode/issues/39560 and https://github.com/microsoft/vscode/issues/108844.

In the meantime, for my extension upon request by a user I created a command to go to the next or previous debug session, see https://github.com/ArturoDent/launch-config/issues/11#issuecomment-1013606260 - but since there is no real supported way to do so it is a bit of a hack but does work.

Outside of my extension you can package the commands yourself via a macro extension like multi-command.

Try these keybindings:

{
  "key": "alt k",      // whatever keybinding you want
  "command": "extension.multiCommand.execute",
  "args": {
    "sequence": [
      "workbench.debug.action.focusCallStackView",
      "list.selectAll",
      "list.collapseAll",
      "list.focusPageDown",       // focus next debug session
      "list.select"
    ]
  },
},

{
  "key": "alt i",      // whatever keybinding you want
  "command": "extension.multiCommand.execute",
  "args": {
    "sequence": [
      "workbench.debug.action.focusCallStackView",
      "list.selectAll",
      "list.collapseAll",
      "list.focusPageUp",       // focus previous debug session
      "list.select"
    ]
  },
}
  • Related