Search code examples
visual-studio-codevscode-debugger

How to make VS Code jump to the current debug point?


When debugging a very large project I commonly find myself starting a debug session, then exploring ahead while the actual debugger is stopped at an earlier point.

Is there a way to refocus the text cursor on the debugger's current execution point without advancing the debugger, i.e. I don't want to step over/into?

I have looked over the existing command and haven't found anything that fit my need. Is there something hidden I maybe haven't found?


Solution

  • You have at least 3 options:

    1. Click the top line of your Call Stack viewlet.

    2. Click the breakpoint in the Breakpoints viewlet. This option does require you to know which breakpoint it is, if the view is wide enough it shows line numbers on the right.

    You could also make a keybinding that will do (1) for you. In your keybindings.json:

    {
      "key": "alt+e",
      "command": "workbench.action.debug.callStackTop",
      "when": "editorTextFocus"      // not necessary
    }
    

    This command is handy as it will take you back to the current execution breakpoint even if you are in another file (or located anywhere in the same file)! I like this so much I am adding it to my list of custom keybindings.