rust-lang / rust-lang/rust-analyzer
Better diagnostics for unlinked projects
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Problem: when opening a project with unusual struture (Cargo.toml buried deep in the source tree) rust-analyzer doesn't work, without a clear error message.
At the moment, when opening the project, we to detect rust project structure we either use likedProjects config, or, if that is absent, look for Cargo.tomls in level one subdirs. So, we fail to discover deeply nested projects.
Soln1: travers all folders, and not only the top level. This is a bad idea, as this is an unbounded amount of work.
Soln2: lazily load Cargo.projects. That is, when a user opens an .rs file which does not belong to any known project, traverse the directory upwards looking for Cargo.toml. This seems like a best solution UX wise on the first glance. There's a big problem though -- non-determinism. If there are two projects, A and B, and A uses B, then opening B first and invoking find useages won't find usages in A, because we don't know about A yet!
Soln3, what we should do: start like soln2, but, instead of magically loading the file, show a popup "add this file to a list of linked projects?". That way, discovery results are persistent, and user always gets the same workspace.
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
No files, tests, or entry points are named. Start by tracing the existing linkedProjects configuration and top-level Cargo.toml discovery, then evaluate the proposed prompt for unlinked Rust files; done means deeply nested projects produce clear, persistent discovery behavior without unbounded traversal or nondeterministic workspace results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100