【发布时间】:2019-02-01 13:44:45
【问题描述】:
我有一个调试启动配置 (launch.json),如下所示。
{
"version": "0.2.0",
"configurations": [
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"preLaunchTask": "Pre Debug Task",
"postDebugTask": "Stop Watch Styles",
"args": ["${relativeFile}"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
}
]
}
我的任务配置(tasks.json)是这样的
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "next:copy",
"label": "Copy Files",
"problemMatcher": []
},
{
"type": "npm",
"script": "styles:tsw",
"label": "Watch Styles",
"problemMatcher": [],
},
{
"label": "Pre Debug Task",
"isBackground": true,
"dependsOn" :[
"Copy Files",
"Watch Styles"
]
},
{
"label": "Stop Watch Styles",
// No sure what should come here
}
]
}
试图在postDebugTask 中停止监视进程,有没有办法通过在tasks.json 中提供名称(Watch Styles)作为参数来终止任务。手表样式是一个持续运行的过程,调试完成后是否有其他方法可以终止任务,请建议。
【问题讨论】:
标签: visual-studio-code vscode-debugger vscode-tasks