-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lazy Workspace/Project Discovery #17537
Comments
I'd expect these to still be different from another, unless I misunderstand this phrase makes it sound like we are unify-ing
I don't think this is necessary for this change. It is necessary to support standalone files, but that is a separate issue that can follow afterwards.
Likewise I don't think this is necessary either, this is a separate issue as well. We can implement lazy discovery without this change. |
They are different, sorry! I'm trying to say that these would go through similar codepaths/mechanisms, as opposed to being fully distinct today.
It's not, strictly speaking, necessary for #17246, but it would simply the currently complicated state machine.
Same thing: it's not really required, but I really think it makes a lot of the subtle bugs would crop up substantially easier to reason about as a result. |
Currently working on a big monorepo with several independent rust crates, each one having a different set of sysdeps (provided via Nix and direnv). This would indeed be very helpful because in our case, it doesn't even make sense to have rust-analyser load all the crates, as the sysdeps for some may not even be in scope. What we do right now is open only a subpart of the monorepo in VSCode, to have just one crate in scope each time. |
Few notes:
Anyway! Project discovery should be entirely lazy. This change makes the following easier:
rust-analyzer.toml
in the rustlings repo, IDE functionality would just work for them.To make this change happen, the currently eager (that is, they occur on startup/workspace folder change)
ProjectManifest::discover_all
+ cargo metadata-style operations would become lazy,rust-analyzer.workspace.DiscoverCommand
-style operations that only happen after startup. This would mean several things:cargo_metadata::MetadataCommand::new()
would become the default mode forflycheck/src/json_workspace.rs
(see this comment. That file would no longer be JSON workspace-specific, but it would also make "project discovery" a first-class concept in rust-analyzer.rust-analyzer.linkedProjects
would technically be lazily evaluated, but if any value is set, it would effectively be "eagerly" evaluated.To support this change, I think three things need to happen:
linked_projects
#17246 needs to land.The text was updated successfully, but these errors were encountered: