ggb*_*667 5 debugging visual-studio-code
从多根工作空间进行调试似乎不起作用 - 这些是一个新功能,也许这是一个错误,但没有实际的示例,只有网站上的伪代码。
Attribute 'program' is not absolute ('${workspaceFolder}/node_modules/mocha/bin/_mocha'); consider adding '${workspaceFolder}/' as a prefix to make it absolute.
Run Code Online (Sandbox Code Playgroud)
尽管显然它已经有了绝对路径。
这是我正在使用的确切启动配置:
在VS CODE PROJECTS.code-workspace文件中:
{
"folders": [
{
"path": "workspace-one"
},
{
"path": "workspace-two"
},
],
"settings": {},
"launch": {
"configurations": [
{
"type": "node",
"request": "launch",
"name": "WS Mocha 1 File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${relativeFile}"
],
"stopOnEntry": false,
"cwd": "${workspaceFolder}",
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
]
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
基本上,我想在特定工作区中打开特定测试进行调试,而不必在每个根工作区中复制启动配置(我有很多根工作区)。.vscode\launch此启动配置在子工作区的文件中运行良好。
ggb*_*667 -1
当复制到每个工作区的每个 .vscode 中时,以下内容似乎有效。但这只是一种解决方法,而不是解决方案。我认为多根工作空间需要更多的工作。调试也很困难,因为每个工作区的断点也会显示,并且按字母顺序排列,不会按工作区排序,也不会过滤为仅显示打开的活动工作区(在工作区中打开文件的工作区)。
.vscode/launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "WS Mocha",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test"
],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
]
},
{
"type": "node",
"request": "launch",
"name": "WS Mocha 1 File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${relativeFile}"
],
"stopOnEntry": false,
"cwd": "${workspaceFolder}",
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
]
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/server/server.js"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是启动配置所需的。从多根工作空间根目录中的 .vscode/settings.json 中的所有工作空间中排除文件很方便。
{
"fileheader.Author": "gbishop",
"fileheader.LastModifiedBy": "gbishop",
"files.exclude": {
"*.csv": "explorerExcludedFiles",
"*.dat": "explorerExcludedFiles",
"coverage": "explorerExcludedFiles",
".build": "explorerExcludedFiles",
"logs/": "explorerExcludedFiles",
"reports/*.xml": "explorerExcludedFiles",
".nyc_output/": "explorerExcludedFiles"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3005 次 |
| 最近记录: |