'VS Code – jump to current debugging position via keyboard

In VS Code, how do I jump to the current position of the debugger? It is indicated by a yellowish line, but I tend to get lost browsing other files and functions, only to struggle finding my way back to where my debugging session is currently paused at.

Should be simple enough, but I could not find anything in the docs. I even went through all actions containing 'debug' in the keyboard map, but did not find what I'm looking for.



Solution 1:[1]

There doesn't appear to be any go to current breakpoint command, only previous and next commands.

However, I see this "bug" might be useful: see repl evaluation causes editor to jump to current breakpoint!

So you could just focus the repl, Enter and you will jump to your current breakpoint. It does pollute your debug console with an undefined result but perhaps that is acceptable.

Or you could assign a keybinding to a macro that executes the focus command and clears the debug console in one go. Using a macro extension of your choice - I am using multi-command below - this would go into your settings:

"multiCommand.commands": [

 {
  "command": "multiCommand.gotoCurrentBreakpoint",
  // "interval": 350,
  "sequence": [

    "workbench.debug.action.focusRepl",
    "repl.action.acceptInput",

    // following command clears the debug console if you wish
    "workbench.debug.panel.action.clearReplAction"
  ]
 }
]

and some keybinding:

{
  "key": "alt+/",
  "command": "extension.multiCommand.execute",
  "args": { "command": "multiCommand.gotoCurrentBreakpoint" },
},

demo of returning to current breakpoint

How long the underlying "bug" - if it is a bug - will be there to use .....?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1