rust-lang / rust-lang/rust-analyzer

Read global ratoml before first config query

Open
#17,712 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

          Given https://github.com/rust-lang/rust-analyzer/pull/17246, it's still not being read early enough -- there is a pretty big chicken/egg problem with configs like this:
[workspace.discoverConfig]
...

We don't read rust-analyzer.toml until workspaces have already been discovered (to find the root), and we can't discover a workspace because haven't read it. I think we need to search upwards from the current working directory to find a rust-analyzer.toml to use on startup.

For rust-analyzer.toml users, these configs will never be populated in src/bin/main.rs:

https://github.com/rust-lang/rust-analyzer/blob/f46af90ba83f38cb7fa55ba9e5620b2ceed58f2b/crates/rust-analyzer/src/bin/main.rs#L268-L273

Originally posted by @cormacrelf in https://github.com/rust-lang/rust-analyzer/issues/17661#issuecomment-2253044846

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

The issue points to crates/rust-analyzer/src/bin/main.rs around lines 268-273 and PR #17246. Read those startup and configuration paths first, then trace how workspace discovery depends on rust-analyzer.toml. Done means a configuration can be found before the first workspace or configuration query, including [workspace.discoverConfig] settings.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.