使用 VSCode 时无法单步执行“仅我的代码"? [英] Can't step through 'Just my code' when using VSCode?
问题描述
调试时 VSCode 中是否有类似 Visual Studio 中的仅我的代码"选项的选项?
Is there a option in VSCode when debugging like the 'Just my Code' option in Visual Studio?
我想单步调试自己的代码,而不是像next_tick.js那样的所有内部节点代码
I want to step through my own code, not all the internal node code like next_tick.js
我试过添加
"skipFiles": [
"node_modules/**/*.js"
]
到调试配置,但这不起作用.
to the debug configuration, but that's not working.
推荐答案
可以在 Visual Studio Code 站点找到答案:https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code-node-chrome
The answer can be found at the Visual Studio Code site: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code-node-chrome
简而言之,您忘记添加 ${workspaceFolder}:
In short, you forgot to add ${workspaceFolder}:
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
"${workspaceFolder}/lib/**/*.js"
]
然而,正如 Mark 所指出的,有一个魔法字符串可以覆盖所有内部节点模块,然后解决方案是:
However, as Mark noted, there is a magic string to cover all internal node modules and then the solution is:
"skipFiles": [
"<node_internals>/**/*.js"
]
添加到 .vscode/launch.json 文件中.
added in the .vscode/launch.json file.
这篇关于使用 VSCode 时无法单步执行“仅我的代码"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!