rust-lang / rust-lang/rust-analyzer
Opening a project of a workspace checks the whole workspace
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I have a workspace which contains a large number of crates.
Say I need to do the following, in that order:
- Update lib L
- Fix crate A to new interface of lib L
- Fix crate B to new interface of lib L
(A and B do not depend on each other)
When I try to completely update crate A, I can't see warnings and in general I get errors from project B, which I haven't fixed yet. This is due to rust-analyzer watching the whole workspace, even though I have only opened the root of A, and the Cargo.toml at the root of my folder is that of A.
I would expect that the current behaviour only happens when I open my workspace folder, and that when I open a single project it doesn't try to build the whole workspace, allowing me to completely fix a crate before moving to the next.
This would also have other benefits:
- Performance: my workspace being very large, I rarely work on all projects at once so I would gain time and space by not building all of it
- Feature flags testing: a global
cargo checkdoes not behave the same way as individual checks: when running a workspace check, all feature flags required in any crate of the workspace are enabled for every crate of the workspace, while when running a crate check, only the flags required for that specific crate are enabled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with a workspace containing independent crates and open a single crate root versus the workspace folder. Trace workspace and project discovery from the opening mode; done when a single-project opening checks only that crate while opening the workspace retains whole-workspace checking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100