-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
82 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,45 @@ | ||
{ | ||
"target": "zig_build", | ||
// "cancel": { "kill": true }, | ||
"cancel": { "kill": true }, | ||
"selector": "source.zig", | ||
"keyfiles": ["build.zig"], | ||
"build": {}, | ||
|
||
"variants": [ | ||
{ | ||
"name": "Run File", | ||
"run": true, | ||
"cmd": ["run", "$file_name"], | ||
}, | ||
{ | ||
"name": "Run Project", | ||
"run": true, | ||
"project": true, | ||
"build": { | ||
"step": "run" | ||
} | ||
|
||
}, | ||
{ | ||
"name": "Test File", | ||
"test":true | ||
"cmd": ["test", "$file_name"] | ||
}, | ||
{ | ||
"name": "Test Project", | ||
"test": true, | ||
"project": true, | ||
"build": { | ||
"step": "test" | ||
} | ||
}, | ||
{ | ||
"name": "Format File", | ||
"format": true, | ||
"cmd": ["fmt", "$file_name"], | ||
"quiet": true, | ||
}, | ||
{ | ||
"name": "Format Project", | ||
"format": true, | ||
"project": true, | ||
"quiet": true | ||
"cmd": ["fmt", "$folder"], | ||
"quiet": true, | ||
}, | ||
{ | ||
"name": "Build Project", | ||
"project": true, | ||
"build": {} | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Build System | ||
The build system provided for Sublime Text depends on `zig` being either in your path or the `zig.executable` setting. The build system comes with predefined build targets for running, testing, and formatting single files or whole projects that use a `build.zig`. If for whatever reason you would want to extend these build targets or add your own (e.g. your own `.sublime-project` file), the following shows all the options available: | ||
```json | ||
{ | ||
// .sublime-project | ||
|
||
"folders": [ | ||
//... | ||
], | ||
"settings": { | ||
// ... | ||
}, | ||
"build_systems": [ | ||
// runs `zig fmt $file_name` | ||
{ | ||
// the build systems functions are all under the `zig_build` command | ||
// `target` must always be `"zig_build"` | ||
"target": "zig_build", | ||
"name": "Format File", | ||
"cmd": ["fmt", "$file_name"] | ||
}, | ||
// runs `zig build install` | ||
{ | ||
// t | ||
"target": "zig_build", | ||
"name": "Install Project", | ||
"step": { | ||
"name": "install" | ||
} | ||
}, | ||
// runs `zig build run -- foo bar` | ||
{ | ||
// t | ||
"target": "zig_build", | ||
"name": "Run Project", | ||
"step": { | ||
"name": "run", | ||
"args": ["foo", "bar"] | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
See the Sublime Text [docs](https://www.sublimetext.com/docs/build_systems.html#variables) for all the possible expansion variables. |