Skip to content

Commit

Permalink
Include VSCode tasks for shared build/test behaviour
Browse files Browse the repository at this point in the history
These are mostly cribbed from ziglang/vscode-zig#30, with the addition of defining zig's `main-pkg-path` to be the workspace. This permits zig files to include any file within the workspace; otherwise, `@import`s of paths outside the zig file's own directory tree will fail with a compile error.
  • Loading branch information
alinebee committed Aug 29, 2020
1 parent 5f2bc88 commit ab2b424
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
zig-cache/
.vscode/
63 changes: 63 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "zig build-exe",
"type": "process",
"command": "zig",
"args": [
"build-exe",
"${file}",
"--main-pkg-path",
"${workspaceFolder}"
],
"group": "build",
"presentation": {
"reveal": "silent",
"showReuseMessage": false,
"clear": true
}
},
{
"label": "zig run",
"type": "process",
"command": "zig",
"args": [
"run",
"${file}",
"--main-pkg-path",
"${workspaceFolder}"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"showReuseMessage": false,
"clear": true
}
},
{
"label": "zig test",
"type": "process",
"command": "zig",
"args": [
"test",
"${file}",
"--main-pkg-path",
"${workspaceFolder}"
],
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"showReuseMessage": false,
"clear": true
},
"problemMatcher": []
}
]
}

0 comments on commit ab2b424

Please sign in to comment.