visual-studio-code - 如何在 VScode 中多次调用任务
问题描述
任务.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Build OpenGL project",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"command": "make",
"presentation": {
"reveal": "never",
"clear": true,
"echo": false
},
},
{
"label": "postdebugKill",
"type": "process",
"command":[
"${command:workbench.action.terminal.kill}",
"${command:workbench.action.acceptSelectedQuickOpenItem}",
],
},
{
"label": "Build & run OpenGL project",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
},
"command": "make",
"args": [
"run"
],
"presentation": {
"reveal": "never",
"clear": true,
"echo": false
},
},
{
"label": "Terminate All Tasks",
"command": "echo ${input:terminate}",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.terminal.kill",
"args": "terminateAll"
},
]
}
启动.json
{
"version": "0.2.0",
"configurations": [
{
"name": "OpenGL",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/bin/app",
"preLaunchTask": "Build OpenGL project",
"postDebugTask": "postdebugKill",
"console": "externalTerminal",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"MIMode": "lldb",
}
]
}
在 Tasks.json 文件中,我有一个 postdebugKill 任务,它会在调试我的 C++ 项目时杀死打开的终端实例,但是如何在 postDebugTask 中调用该任务 2 次,以便关闭打开的 2 个终端实例。
当我在 vscode 中启动 CPP 调试器时,它会打开两个终端选项卡,那么如何多次调用 postdebugKill 来终止多个终端实例。
解决方案
推荐阅读
- python - 删除重复值并查找python中具有最多值的键
- javascript - 获取数组的总和
- excel - 如何按您输入的产品名称填写用户表单如果excel中有两个相同的产品
- ios - 使用 DateFormatter 返回 nil 的字符串中的日期
- mysql - SQL 错误:1191 找不到与列列表匹配的 FULLTEXT 索引
- android - 获取 Android 虚拟设备上输入的坐标和屏幕截图
- python - CSV 到 JSON 转换组合集属于同一个键
- r - 如何像在 facet_grid 中一样在 facet_wrap 中定位条形标签
- python - 在 Pandas 的输出中添加唯一值
- node.js - 尝试添加 opencv 时 Heroku CI 构建失败,但应用程序部署有效