Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are Nodejs breakpoints in VS Code disabled depending on whether the full path appears in the tab title?

A breakpoint in my Mocha test works when set on the exact same line in one VS Code tab but not in another.

The difference: If the full path appears in the tab, then breakpoints work. (Second item in screenshot.)

Two different access paths

But if the filename, without path, appears in the tab header, then breakpoints all become Unverified (gray) during execution.

Repro steps:

  • If you open files from the Explorer view, the bug occurs.
  • If you open files using CTRL-P, as in the screenshot, then both variants are usually available, and choosing the one with/without path gives the different behaviors.

How can I avoid this without continually checking which path variant is appearing?

(Here is a GitHub ticket that I opened.)

like image 663
Joshua Fox Avatar asked Jun 27 '19 09:06

Joshua Fox


People also ask

How to fix VSCode breakpoints not working?

Any code with breakpoints executed before vscode could attach, will not trigger the breakpoint. To solve this, either restart the debugger after it has initially loaded (keep Chrome open). use .scripts command in Debug console to see the loaded scripts. Make sure the paths of the scripts is correct.

Why is breakpoint not working in Bootstrap?

Breakpoint ignored because generated code not found (source map problem?). You’ll have to make sure that your generated source map points to the correct file paths. In your launch.js

What is a disabled breakpoint in Visual Studio?

Disabled breakpoints are represented by a filled gray circle, whereas a gray hollow circle signals breakpoint that can’t be registered. The latter may also apply if you’re editing the source while your debug sessions without live-editing support are in progress.

Why are breakpoints not working in chrome debugger?

Breakpoints may still not trigger on initial load. When you start the debugger which launches Chrome, there is a lag before vscode can attach to Chrome. Any code with breakpoints executed before vscode could attach, will not trigger the breakpoint. To solve this, either restart the debugger after it has initially loaded (keep Chrome open).


1 Answers

Answer (figured out on the GitHub thread):

My workspace path was under a symbolic link (Ubuntu).

VS Code apparently dereferences symbolic links to give Node a path that it can work with, to support breakpoints.

VS Code also shows the file at the correctly referenced path in my workspace folder as I defined it (under the symbolic link).

like image 55
Joshua Fox Avatar answered Oct 19 '22 15:10

Joshua Fox