如何从任务中触发命令面板操作?
How can I trigger a command palette action from a task?
我创建了这个任务:
{
"label": "Regen Coverage",
"type": "shell",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"command": [
"go test ./internal/... --tags=dynamic,integration -coverpkg=./... -count=1 -coverprofile ./cover.out",
"gcov2lcov -infile=cover.out -outfile=cover.lcov",
]
}
我想从扩展程序触发命令面板操作(命令是 Coverage Gutters: Watch
。我 认为 这应该是可能的,基于这张票: https://github.com/microsoft/vscode/issues/11396,但我不知道这个命令叫什么,文档说命令必须 return 一个字符串。有什么想法吗?
感谢@rioV8 我能够从键绑定 GUI 中找到 commandID。这是生成的任务设置:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "run integration tests and cover",
"type": "shell",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"command": [
"go test ./internal/... --tags=dynamic,integration -coverpkg=./... -count=1 -coverprofile ./cover.out",
"gcov2lcov -infile=cover.out -outfile=cover.lcov"
]
},
{
"label": "Regen and Watch Coverage",
"dependsOn": [
"run integration tests and cover"
],
"presentation": {
"reveal": "always",
"panel": "shared"
},
"command": [
"${command:coverage-gutters.watchCoverageAndVisibleEditors}"
],
"problemMatcher": []
}
]
}
我创建了这个任务:
{
"label": "Regen Coverage",
"type": "shell",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"command": [
"go test ./internal/... --tags=dynamic,integration -coverpkg=./... -count=1 -coverprofile ./cover.out",
"gcov2lcov -infile=cover.out -outfile=cover.lcov",
]
}
我想从扩展程序触发命令面板操作(命令是 Coverage Gutters: Watch
。我 认为 这应该是可能的,基于这张票: https://github.com/microsoft/vscode/issues/11396,但我不知道这个命令叫什么,文档说命令必须 return 一个字符串。有什么想法吗?
感谢@rioV8 我能够从键绑定 GUI 中找到 commandID。这是生成的任务设置:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "run integration tests and cover",
"type": "shell",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"command": [
"go test ./internal/... --tags=dynamic,integration -coverpkg=./... -count=1 -coverprofile ./cover.out",
"gcov2lcov -infile=cover.out -outfile=cover.lcov"
]
},
{
"label": "Regen and Watch Coverage",
"dependsOn": [
"run integration tests and cover"
],
"presentation": {
"reveal": "always",
"panel": "shared"
},
"command": [
"${command:coverage-gutters.watchCoverageAndVisibleEditors}"
],
"problemMatcher": []
}
]
}