3 回答
TA貢獻1886條經驗 獲得超2個贊
以下似乎有效,但似乎您無法將運行鏈接到&&:
{
"version": "0.1.0",
"isShellCommand": true,
"showOutput": "always",
"command": "go",
"echoCommand": true ,
"tasks": [
{
"taskName": "build",
"args": [
"-x",
"-o",
"${workspaceRoot}.exe"
],
"isBuildCommand": true
},
{
"taskName": "fmt",
"args": [
"${file}"
]
}
]
}
TA貢獻1798條經驗 獲得超3個贊
我最喜歡的構建任務是:
{
"version": "0.1.0",
"isShellCommand": true,
"showOutput": "always",
"command": "go",
"echoCommand": true ,
"options": {
"cwd": "${fileDirname}"
},
"tasks": [
{
"taskName": "build",
"args": [
"build",
"-x"
],
"isBuildCommand": true,
"suppressTaskName": true
}
]
}
TA貢獻1799條經驗 獲得超8個贊
您應該添加屬性suppressTaskName。
刪除多余build參數的OP 解決方案顯然有效,但是,VSCode 的文檔涵蓋了這個非常示例:
我們設置suppressTaskName為 true,因為默認情況下,任務名稱也會傳遞給將導致“echo hello Hello World”的命令。
{
"version": "0.1.0",
"command": "echo",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"tasks": [
{
"taskName": "hello",
"args": ["Hello World"]
},
{
"taskName": "bye",
"args": ["Good Bye"]
}
]
}
- 3 回答
- 0 關注
- 250 瀏覽
添加回答
舉報
