我在Visual Studio代码中运行一个可以执行我的JS文件(使用duktape)的外部二进制文件的调试设置。调试适配器当前仅支持附加请求(不启动),所以我必须在调试JS脚本之前运行二进制文件。如何让vscode不等待完成preLaunchTask?
为了避免启动应用程序手动我创建了一个任务,并设置在我launch.json文件:
{
"version": "0.2.0",
"configurations": [{
"name": "Attach MGA",
"type": "duk",
"preLaunchTask": "debug mga",
"request": "attach",
"address": "localhost",
"port": 9091,
"localRoot": "${workspaceRoot}",
"stopOnEntry": false,
"debugLog": true
}]
}
的任务是定义这样:
{
"version": "0.1.0",
"command": "<absolute path to>/mga",
"isShellCommand": false,
"showOutput": "always",
"suppressTaskName": true,
"tasks": [{
"taskName": "debug mga",
"args": ["--debugger", "main.json"]
}]
}
现在的问题是,当应用程序等待调试器连接时,vscode会等待预启动任务完成。 Catch 22.
如何避免vscode等待预启动任务完成?
更新:
同时我已经the vscode task page念起来完成这个任务的配置上来。不过,它不适合我
{
"version": "2.0.0",
"tasks": [
{
"label": "launch-mga",
"type": "shell",
"command": "<absolute path to>/mga",
"args": [
"config/main.json",
"--debugger"
],
"isBackground": true,
"problemMatcher": {
"owner": "custom",
"pattern": {
"regexp": "_____"
},
"background": {
"activeOnStart": true,
"beginsPattern": "^.*Waiting for debug connection.*$",
"endsPattern": "^.*blah.*$"
},
},
}
]
}
启动的应用程序打印工作等待消息,然后等待无休止的调试连接。也许这个问题与用C++编写的应用程序(这有点类似于终端应用程序的Node.js)有关?
这没有帮助。 vscode仍在等待预启动任务完成。 –