-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module in build.zig is not considered as a BuildConfig packages #1629
Comments
Hi, Is there a repository I can checkout? I'd like to see the build.zig files and where the expected For reference (not saying it's the same) : Line 20 in 35351a6
|
Hi, I've created a simple reproduce repo. https://github.com/evopen/zls-issue-1629. My thought is
In your example, |
build.zig discovery logic aside, this seems to be a timing issue - try opening the Line 1081 in 35351a6
calls Line 1110 in 35351a6
which calls Line 975 in 35351a6
which queues up a build runner run Lines 1008 to 1010 in 35351a6
which happens after Line 1034 in 35351a6
=> package_uris.items.len == 0 in most cases.
|
Ok I think you are right. Build Config is read before write. And build file walker walks from root towards the file of interest, I got it wrong. Sorry for drawing the wrong conclusion. |
Zig Version
0.12.0-dev.1684+ea4a07701
Zig Language Server Version
38a1998
Steps to Reproduce
I'm using nested structure in a monorepo which contains multiple Zig packages (multiple build.zig.zon and build.zig) and there is a build.zig in the root directory.
A package A in the subdirectory contains a test target with a associated test step and a bare module without a step. Another package B reference A in its zon file and build.zig. Zig builds package B fine.
First I thought I was the build.zig discovery mechanism introduced in #688. The root build.zig does not reference package A. Package A's build.zig does but the build runner fails to find them, because
addTest
of package A which is namedroot
in build runner anduriAssociatedWithBuild
consider uri unmatched.b.addModule
is not deemed as a package in build runner.ZLS in this case choose the root build.zig as the associated build file for package A and everything falls apart.
A simple workaround in my case would be to change root build.zig to a normal zig file and run with
zig run
.But the root cause is the module handling I think. Did I miss something?
Expected Behavior
ZLS finds the correct module when parsing package B.
Actual Behavior
ZLS cannot parse the
@import
statement resulting in an unknown type.The text was updated successfully, but these errors were encountered: