{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "build", // 取个名字 "type": "shell", "command": "g++ -g hello.cpp -o hello", // 执行的命令 "group": { // 从这里 "kind": "build", "isDefault": true }, // 到这里,设置为默认构建任务,按Ctrl+Shift+B立即执行,不必选择 "problemMatcher": "$gcc"// 问题匹配程序 } ] }
{ "key": "ctrl+h", "command": "workbench.action.tasks.runTask", "args": "Run tests" }
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "Run tests", "type": "shell", "command": "./scripts/test.sh", "windows": { "command": ".\scripts\test.cmd" }, "group": "test", "presentation": { "reveal": "always", "panel": "new" } } ] }
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "task", "type": "shell", "group": { "kind": "build", "isDefault": true }, "command": "cd C:/Users/gaochaowei/Documents/code.work/012_go/007_RoyalCloud;go run ./main.go", "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared", "showReuseMessage": true, "clear": false } }, ] }
在JSON中设置快捷键
位置
C:UsersxxxxxAppDataRoamingCodeUserkeybindings.json
示例
{ "key": "Ctrl+U", "command":"workbench.action.tasks.runTask", "args": "scp" }
- 始终
- 从不
- 无声
- shared
- 专用
- new
修正中文显示乱码
文件->首选项->设置 ->搜索
“files.autoGuessEncoding”: false
将其用户设置改为
“files.autoGuessEncoding”: true