Skip to content

Read global ratoml before first config query #17712

@alibektas

Description

@alibektas
          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:

if config.discover_workspace_config().is_none()
&& !config.has_linked_projects()
&& config.detached_files().is_empty()
{
config.rediscover_workspaces();
}

Originally posted by @cormacrelf in #17661 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions