Open davidbarsky opened 3 days ago
cargo_metadata::MetadataCommand::new()
would become the default mode forflycheck/src/json_workspace.rs
I'd expect these to still be different from another, unless I misunderstand this phrase makes it sound like we are unify-ing cargo
and rust-project.json
like projects.
The crate graph should be lifted into a standalone, Salsa database.
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.
A nice performance bonus, the VFS should be able to load all a project's files https://github.com/rust-lang/rust-analyzer/issues/17491#issuecomment-2189251164.
Likewise I don't think this is necessary either, this is a separate issue as well. We can implement lazy discovery without this change.
cargo_metadata::MetadataCommand::new()
would become the default mode forflycheck/src/json_workspace.rs
I'd expect these to still be different from another, unless I misunderstand this phrase makes it sound like we are unify-ing
cargo
andrust-project.json
like projects.
They are different, sorry! I'm trying to say that these would go through similar codepaths/mechanisms, as opposed to being fully distinct today.
The crate graph should be lifted into a standalone, Salsa database.
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.
It's not, strictly speaking, necessary for https://github.com/rust-lang/rust-analyzer/pull/17246, but it would simply the currently complicated state machine.
A nice performance bonus, the VFS should be able to load all a project's files #17491 (comment).
Likewise I don't think this is necessary either, this is a separate issue as well. We can implement lazy discovery without this change.
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.
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: