Skip to content

rustfmt override no longer works as a relative path #15595

Closed
@RalfJung

Description

@RalfJung

I'm afraid #15564 has caused new problems... rustfmt doesn't work in the rustc workspace at all any more. The override is

    "rust-analyzer.rustfmt.overrideCommand": [
        "./build/host/rustfmt/bin/rustfmt",
        "--edition=2021",
    ],

and now this is interpreted relative to the directory the file is in, which of course does not work.

[Error - 2:59:01 PM] Request textDocument/formatting failed.
  Message: Failed to spawn cd "/home/r/src/rust/rustc.3/compiler/rustc_middle/src/mir" && "./build/host/rustfmt/bin/rustfmt" "--edition=2021"
  Code: -32603 

Probably this could be fixed by having RA do workspace_dir.join(rustfmt_path) so that it doesn't rely on a relative directory any more.

rust-analyzer version: rust-analyzer version: 0.3.1657-standalone

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions