TIL: VS Code Tasks (from the archives)
tilvscodetooling
I was looking for a way to quickly run a make command without opening the terminal every time I made a change and wanted to preview it. Turns out VS Code has this built in as Tasks.
Setting it up
You define tasks in a .vscode/tasks.json file. Here's a minimal setup that makes make the default build task:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}Running it
Once configured, you can trigger the default build task any time with Cmd+Shift+B. No terminal switching, no typing — just a keyboard shortcut and it runs in the background.
The "reveal": "silent" option is nice because it keeps the terminal panel from stealing focus unless there's an error. You stay in your editor and the build just happens.
Check out the official docs for more on the tasks.json format.