rust-lang / rust-lang/rust-analyzer

Single-package mode

Open
#11,181 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Today rust-analyzer unconditionally operates on the whole workspace, even if you open a subfolder of the workspace with a single package. It might be reasonable to scope the work to a single package in such cases.

The tradeoff here is:

  • when you open a single package, refactors don't work across the workspace
  • but ra needs to cargo check a single package only, which is especially helpful if the overall build is broken

I haven't thought too deeply how this all should work exactly.

related user request: https://github.com/rust-analyzer/rust-analyzer/issues/10730

Relevant code:

https://github.com/rust-analyzer/rust-analyzer/blob/1ba9a924d7b161c52e605e157ee16d582e4a8684/crates/project_model/src/workspace.rs#L139-L145

https://github.com/rust-analyzer/rust-analyzer/blob/1ba9a924d7b161c52e605e157ee16d582e4a8684/crates/project_model/src/lib.rs#L84

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked sections of crates/project_model/src/workspace.rs and crates/project_model/src/lib.rs to understand how workspace scope is selected. Clarify the intended behavior for opening a single package, including the refactoring tradeoff and single-package cargo check, then identify how completion can be verified against the related user request.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.