Resolve build file and main module based on uri - #3252
Open
sukus21 wants to merge 1 commit into
Open
Conversation
This is a fallback, if the regular method fails. I am not sure how well this method actually works, as it does multiple string compares. There should be a more elegant way of doing this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Attmepts to resolve #3194
If associated build file for a file cannot be calculated, loop over known build files, and pick the one with the URI that matches the best. This is intended as a fallback, if the regular reference-based method fails. I am not sure how well this actually works or performs, as it does multiple string compares. There might be a more elegant way of this this, but I haven't found it yet.
This covers the common project setup, where you have a
build.zigfile at the root of the project, and ensures that sub-directories with valid build files still refer to their ownbuild.zig, which is "closer" in the source tree.I'm unsure if the project at large wants this code. It's something I hacked together after poking around the ZLS code for a couple hours. If this is a solution the ZLS team wants to move on with, I'd be happy to make any adjustments or relocate this code somewhere else.