atom-ide-rust icon indicating copy to clipboard operation
atom-ide-rust copied to clipboard

Support custom command / toolchain for rustfmt

Open msrd0 opened this issue 3 years ago • 3 comments

I'd like to be able to use nightly Rust for rustfmt but keep using stable Rust for everything else. Stable rust is set as the default toolchain in rustup and I always call cargo +nightly fmt for code formatting. However, I couldn't find any option in atom-ide-rust to replicate this behaviour. Instead, everytime I save a file this package adds a whole bunch of trailing commas, likely because the option to remove those is unstable and ignored by stable rustfmt.

msrd0 avatar Aug 16 '21 23:08 msrd0

Version 1.1.0 should support this by configuring rust-analyzer with rust-analyzer.json

From https://rust-analyzer.github.io/manual.html#configuration :

rust-analyzer.rustfmt.extraArgs (default: [])

  • Additional arguments to rustfmt.

rust-analyzer.rustfmt.overrideCommand (default: null)

  • Advanced option, fully override the command rust-analyzer uses for formatting.

Green-Avocado avatar Dec 02 '21 05:12 Green-Avocado

We can probably add a note to the readme explaining an example

aminya avatar Dec 02 '21 06:12 aminya

@Green-Avocado rust-analyzer.json does not seem to be loaded. I tried restart all language servers, tested with misformatted json to force an error. It failed to even show any change.

My json:

{
  "cargo.unsetTest": [
    "minitrace"
  ]
}

Edit: turns out when I tried reinstalling my ide-rust package, it did not update to 1.1.1.

It works now that I've made sure it updates.

jon-chuang avatar Feb 23 '22 17:02 jon-chuang