Skip to content

fix: avoid treating modules named build.zig as build scripts - #3250

Open
vkurilyak wants to merge 2 commits into
zigtools:masterfrom
vkurilyak:fix/3249-build-script-detection
Open

fix: avoid treating modules named build.zig as build scripts#3250
vkurilyak wants to merge 2 commits into
zigtools:masterfrom
vkurilyak:fix/3249-build-script-detection

Conversation

@vkurilyak

Copy link
Copy Markdown

Fixes #3249.

I am a fan of Zig and VS Code, and I decided to contribute to ZLS tooling after looking into this issue.

ZLS currently treats any file named build.zig as a build script. This can make ordinary modules run through the build runner and produce misleading diagnostics.

This change checks for the public build entry point before loading build configuration or starting build-on-save. It also adds regression coverage for both a valid build script and an ordinary module named build.zig.

I typically follow a defensive programming style and use assertions to make important invariants explicit. I added a few here to help catch issues like this earlier. If the project prefers those assertions to be removed, please let me know.

Tests:

  • zig build check test -j1 --summary all

@vkurilyak
vkurilyak force-pushed the fix/3249-build-script-detection branch from 10e5982 to 267f187 Compare August 24, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong diagnostic of import file outside module path when module named build.zig

1 participant