zls icon indicating copy to clipboard operation
zls copied to clipboard

Build on save should look for a "check" step

Open Techatrix opened this issue 1 year ago • 1 comments

Some projects (Example: Tigerbeetle, Ziggy) have added a top-level-step called "check" to their build.zig which compiles their project without emitting the final binary. This avoids the extra compilation time spend in LLVM.

ZLS should see if the project has such a step and prefer it over the "install" step when running build on save.

Techatrix avatar Jun 13 '24 17:06 Techatrix

Personally I think this would be a great addition and I would even take it one step further:

If a project has a "check" step, enable build on save automatically and use it. Otherwise the user would have to manually enable the build_on_save behavior to avoid unexpected freezes / resource hogging.

Maybe the config file could be changed to accept a "build_on_save_step" field which defaults to "check" when unset (and that does nothing if the defined step doesn't exist).

Lastly, IMO this could also be a good setting to offer per-project and not just as a global config.

kristoff-it avatar Jul 01 '24 23:07 kristoff-it