Use the default top-level step for build information #2305
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently ZLS cannot correctly resolve
@import("root")
when there are multiple top-level steps defined in the build script (which is common when say the user needs a test step or something), since it refers to all theroot_module
s as "root". This leads to errors in the subsequent analysis and wrong derived type affecting inlay hints and auto-completion, because ZLS simply iterates through all packages and find the first one with its name equal to "root".This PR makes ZLS only analyze the default step, which is often "install", to eliminate such ambiguity. It only does so when
build_on_save
is not set, so the user could still customize the build commands.Example to reproduce
Result (master branch, commit d697a73):