Skip to content

x.py feature request: support "x.py fmt" as rust-analyzer formatter #102837

Closed as not planned
@RalfJung

Description

@RalfJung

When working with vscode in the rustc repo, one needs to set a rustfmt invocation to use for formatting files. The dev guide recommends

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

However, this command fails when rustfmt has not been extracted yet, so I often get errors from vscode here and then I have to do x.py fmt on the terminal by hand to make things work again. (Also the user has to figure out the right TARGET_TRIPLE themselves.)

It would be nice if one could set the overrideCommand to x.py such that extracting the bootstrap rustfmt can happen automatically. However, x.py fmt doesn't work since that always formats everything, not just a single file RA does formatting via stdin/stdout, which is not how x.py fmt works.

Cc @jyn514

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions