You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zls/guides/build-on-save.smd
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ Once you're done with this, restart your editor (or at least ZLS), **save your f
67
67
68
68
### Customize build arguments
69
69
70
-
By default, ZLS will run the equivalent of the following command:
70
+
By default, ZLS will try to run the equivalent of the following command:
71
71
72
72
```
73
73
zig build check --watch
@@ -83,6 +83,23 @@ To further customize the build arguments, the `build_on_save_args` config option
83
83
84
84
Run `zig build --help` to find out what build steps and build options are available in your project.
85
85
86
+
### Incremental Compilation (experimental)
87
+
88
+
As of [Zig 0.15.x](https://ziglang.org/download/0.15.1/release-notes.html#toc-Incremental-Compilation), incremental compilation is still under active development:
89
+
90
+
> Zig 0.15.x makes further progress on the work-in-progress Incremental Compilation functionality, which allows the compiler to perform very fast rebuilds by only re-compiling code which has changed. Various bugs have been fixed, particularly relating to changing file imports.
91
+
>
92
+
> This feature is still experimental—it has known bugs and can lead to miscompilations or incorrect compile errors. However, it is now stable enough to be used reliably in combination with `-fno-emit-bin`.
93
+
94
+
Because the previously mentioned "check" step only reports compile errors without emitting code, it integrates well with incremental compilation:
95
+
96
+
To try it out:
97
+
- Ensure that your project defines a "check" step
98
+
- Do **not** enable the `enable_build_on_save` config option
99
+
- Set `"build_on_save_args": ["-fincremental"]`
100
+
101
+
Restart ZLS and review the [log output](/zls/guides/view-logs) to ensure there are no errors and that the config options were applied correctly. At this point, compile errors should appear *almost* instantly as you make changes.
102
+
86
103
## Special Thanks
87
104
88
105
This Guide is based on the ["Improving Your Zig Language Server Experience"](https://kristoff.it/blog/improving-your-zls-experience/) Blog Post by Loris Cro.
0 commit comments