Build (tasks.json
):
{
"tasks": [
{
"command": "zig build --summary all",
"group": "build",
"label": "build",
"presentation": {
"clear": true,
"echo": true,
"focus": false,
"panel": "shared",
"reveal": "silent",
"showReuseMessage": false
},
"problemMatcher": [
"$zig"
],
"promptOnClose": false,
"type": "shell"
},
{
"command": "zig build test --summary all",
"group": "test",
"label": "test",
"presentation": {
"clear": true,
"echo": true,
"focus": false,
"panel": "shared",
"reveal": "always",
"showReuseMessage": false
},
"problemMatcher": [
"$zig"
],
"promptOnClose": false,
"type": "shell"
}
],
"version": "2.0.0"
}
Debug launch.json
:
{
"configurations": [
{
"args": [],
"cwd": "${workspaceFolder}",
"name": "Debug",
"preLaunchTask": "build",
"program": "${workspaceFolder}/zig-out/bin/hello",
"request": "launch",
"type": "lldb"
}
],
"version": "0.2.0"
}
The first task (labeled build
) is called when starting debugging from preLaunchTask
to run zig build
. Debugging expects the CodeLLDB
extension.
The second task runs the tests (labeled test
) using zig build test
.
Enable Build On Save to run zig build check
and display all errors in the vscode.
More information for debugging using vscode
: