rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.26k stars 1.61k forks source link

Read global ratoml before first config query #17712

Open alibektas opened 3 months ago

alibektas commented 3 months ago
          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

alibektas commented 3 months ago

This will be waiting for #17537 to be implemented first, as it has a certain relevance in terms of project discovery.