As I’ve been coding through the AoC entries, I’m finding myself going back and forth between the terminal to run zig build run and VSCode only to see that most of the time, zig build run outputs errors even though VSCode doesn’t indicate any errors with ZLS.
ZLS has an option to build on save: Build-On-Save - zigtools
I believe this feature is off by default. When you enable this, it will run the build and get you more information.
Whoahh!! This build-on-save is SO MUCH better than what I’ve ever had in my Zig VSCode experience. IMO this should be the primary way to use it and all the docs should point to this method as the first thing to try! This might be a game changer for my Zig editing ergonomics.
FWIW, the reason why VSCode settings for “Enable Build on Save” did nothing was because I did not have a “check” step in my build.zig. The option help strings could make this requirement a little more obvious, I guess.