Skip to content

Commit

Permalink
add build_on_save_step config option
Browse files Browse the repository at this point in the history
This allows selecting which step should be executed when running
build-on-save like `zig build install`, `zig build test`, etc.
  • Loading branch information
Techatrix committed Dec 20, 2023
1 parent ea709f4 commit 958e8c7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The following options are currently available.
| `enable_argument_placeholders` | `bool` | `true` | Whether to enable function argument placeholder completions |
| `enable_ast_check_diagnostics` | `bool` | `true` | Whether to enable ast-check diagnostics |
| `enable_build_on_save` | `bool` | `false` | Whether to enable build-on-save diagnostics |
| `build_on_save_step` | `[]const u8` | `"install"` | Select which step should be executed on build-on-save |
| `enable_autofix` | `bool` | `false` | Whether to automatically fix errors on save. Currently supports adding and removing discards. |
| `semantic_tokens` | `enum` | `.full` | Set level of semantic tokens. Partial only includes information that requires semantic analysis. |
| `enable_inlay_hints` | `bool` | `true` | Enables inlay hint support when the client also supports it |
Expand Down
5 changes: 5 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"type": "boolean",
"default": "false"
},
"build_on_save_step": {
"description": "Select which step should be executed on build-on-save",
"type": "string",
"default": "\"install\""
},
"enable_autofix": {
"description": "Whether to automatically fix errors on save. Currently supports adding and removing discards.",
"type": "boolean",
Expand Down
3 changes: 3 additions & 0 deletions src/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ enable_ast_check_diagnostics: bool = true,
/// Whether to enable build-on-save diagnostics
enable_build_on_save: bool = false,

/// Select which step should be executed on build-on-save
build_on_save_step: []const u8 = "install",

/// Whether to automatically fix errors on save. Currently supports adding and removing discards.
enable_autofix: bool = false,

Expand Down
6 changes: 6 additions & 0 deletions src/config_gen/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"type": "bool",
"default": "false"
},
{
"name": "build_on_save_step",
"description": "Select which step should be executed on build-on-save",
"type": "[]const u8",
"default": "\"install\""
},
{
"name": "enable_autofix",
"description": "Whether to automatically fix errors on save. Currently supports adding and removing discards.",
Expand Down
1 change: 1 addition & 0 deletions src/features/diagnostics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ pub fn generateBuildOnSaveDiagnostics(
const base_args = &[_][]const u8{
server.config.zig_exe_path orelse return,
"build",
server.config.build_on_save_step,
"--zig-lib-dir",
server.config.zig_lib_path orelse return,
"--cache-dir",
Expand Down

0 comments on commit 958e8c7

Please sign in to comment.