rust-lang / rust-lang/rust-analyzer

Support fallback for `discoverConfig`

Open
#20,622 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://rust-analyzer.github.io/book/configuration.html#workspace.discoverConfig let's rust-analyzer discover the project layout when using non-Cargo build systems.

However, this causes issues when jumping to non-first-party code, such as anything in the sysroot (particularly the standard library) and third-party code coming from crates.io. This code is built using Cargo, so it does not contain BUILD/BUCK files, even though Bazel/Buck2 can build it.

It seems to me that the best thing to do in that case would be for rust-analyzer to fall back to using Cargo in such situation. The fallback behavior could be configurable, in case some people want a stricter/more hermetic setup that doesn't just fall back to the ambient environment's Rust toolchain.

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 with the discoverConfig behavior described in the configuration documentation, then trace how rust-analyzer handles non-first-party code from the sysroot and crates.io. Done means Cargo can be used as a fallback for that code, with a configurable option for users who require stricter or hermetic behavior.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.