fix(lsp): Ensure stdlib is always added before the check_crate
phase
#1840
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.
Description
Problem*
Resolves #1833
Summary*
This moves the addition of the stdlib to the dependency graph into
Driver::check_crate
, which is the point we know the root is configured and all other dependencies have been added to the driver. This ensures that no matter how or when you calldriver.check_crate
(e.g.nargo_cli
,lsp
, ornoir_wasm
), the stdlib will always be available.This solution is sub-optimal because the stdlib should probably be the first crate added to the dependency graph and then it should be propagated to each new dep as it is added, but that seemed like a much larger refactor because a lot of the code in the compiler expects
FileId(0)
to be the crate root.Documentation
This PR requires documentation updates when merged.
Additional Context
In making this change I also discovered #1839
PR Checklist*
cargo fmt
on default settings.