问题
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.)
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.)
回答1:
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).
来源:https://stackoverflow.com/questions/56788044/why-are-nodejs-breakpoints-in-vs-code-disabled-depending-on-whether-the-full-pat