gpt4 book ai didi

debugging - 如何在 Visual Studio Code 中为多根工作区使用调试启动配置?

转载 作者:行者123 更新时间:2023-12-05 08:08:28 24 4
gpt4 key购买 nike

调试自 multi-root-workspaces似乎不起作用 - 这些是新功能,也许这是一个错误,但没有实际示例,只有网站上的伪代码。

Attribute 'program' is not absolute ('${workspaceFolder}/node_modules/mocha/bin/_mocha'); consider adding '${workspaceFolder}/' as a prefix to make it absolute.

虽然显然它已经有了绝对路径。

这是我使用的确切启动配置:

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",
]
}
]
}
}

基本上,我想在特定工作区中打开特定测试以进行调试,而不必在每个根工作区中复制启动配置(我有很多)。此启动配置在子工作区的 .vscode\launch 文件中运行良好。

最佳答案

这是通过复合启动配置解决的,它只是对配置名称的引用。我刚刚测试过它并且工作正常:https://code.visualstudio.com/docs/editor/multi-root-workspaces#_workspace-launch-configurations .你最终会得到这样的结果。

"launch": {
"configurations": [],
"compounds": [
{
"name": "Attach to .NET Functions",
"configurations": [
"Attach to .NET Functions YOUR_UNIQUE_LAUNCH_CONFIG_NAME"
]
}
]
}

关于debugging - 如何在 Visual Studio Code 中为多根工作区使用调试启动配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49075241/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com