vscode: Automatically focus on the line when a breakpoint hits, even at the same file

In Visual Studio, there is this feature that when a breakpoint is hit, no matter which tab the user is currently looking at, it always jumps to the breakpoint file, and center the breakpoint line. In fact, if the file is not open at the moment, Visual Studio will open that file in a new tab then focus the line.

Visual Studio Code currently has most of the feature replicated, controlled by debug.focusEditorOnBreak and debug.focusWindowOnBreak settings. However, it’s strangely missing a key part: if user is currently at the same file the breakpoint hits, it doesn’t center the view to the breakpoint line.

This (mis-)behavior is annoying because sometimes when launching a debug session, while waiting for the compilation to finish, I’d scroll to other part of the file, expecting the breakpoint. But nothing seemingly happens. I honestly thought the compilation might failed, but there is no error in problems, and get confused. Turns out it hits a breakpoint above (out of the view).

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Same issue for me on Version: 1.84.2/Electron: 25.9.2

I am working on Lua implementation of DAP - it happens both for hitting a BP or when manually pressing the Pause button from VSCode. When Smooth Scroll is disabled it properly jumps to the line even if VSCode is already editing the same file.