VS Code: Tasks Automation (`tasks.json`)
Complete guide to configuring automated build, test, and watch tasks in .vscode/tasks.json, task problem matchers, and keyboard shortcut triggers.
VS Code Tasks allow you to map shell commands, build pipelines, and test runners into native editor actions with automatic error highlighting via problem matchers.
Configuring .vscode/tasks.json
Open Command Palette $\rightarrow$ Tasks: Configure Task:
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$tsc"],
"label": "npm: build (default)"
},
{
"type": "shell",
"command": "npm run test",
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"label": "Run Unit Tests"
},
{
"type": "shell",
"command": "docker compose up -d",
"label": "Start Dev Containers",
"problemMatcher": []
}
]
}Running Tasks
- Trigger Default Build Task: Cmd/Ctrl + Shift + B
- Open Task Runner: Open Command Palette $\rightarrow$
Tasks: Run Task
Problem Matchers
Problem matchers parse the raw stdout/stderr output of compilers (tsc, eslint, gcc) and convert errors directly into clickable underlines in your code and entries in the Problems Panel (Cmd/Ctrl + Shift + M).
Related Guides
VS Code: Git & Version Control Integration
Complete guide to VS Code Git integration, Source Control panel, stage ranges, 3-way merge conflict editor, timeline view, and branch management.
VS Code: Remote - SSH Development
Complete guide to using the Remote - SSH extension in VS Code to edit files, run debuggers, and execute terminals on remote Linux servers and cloud VMs.