Skip to content

Support repo-relative paths in rust-analyzer.server.path #13939

Closed
@OmarTawfik

Description

@OmarTawfik

The VS Code configuration rust-analyzer.server.path exists to use a local binary, which is great when testing stuff, and also when using from a dev container. However, it expects a full path, which doesn't work well with version-controlled binaries. For example, if I set it to:

    // relative to VS Code workspace/repo root
    "rust-analyzer.server.path": "bin/rust-analyzer",

The extension will fail, printing the following error to Rust Analyzer Client VS Code output channel:

INFO [1/12/2023, 7:10:00 PM]: Starting language client
INFO [1/12/2023, 7:10:00 PM]: Using server binary at bin/rust-analyzer
ERROR [1/12/2023, 7:10:00 PM]: Bootstrap error Error: Failed to execute bin/rust-analyzer --version. `config.server.path` or `config.serverPath` has been set explicitly. Consider removing this config or making a valid server binary available at that path.

I wanted to propose executing that command relative to the workspace directory, to allow users to specify paths that are relative to the repository they are working on, instead of forcing them to use machine-wide installations.

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