Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Support custom command / toolchain for rustfmt #203

Open
msrd0 opened this issue Aug 16, 2021 · 3 comments
Open

Support custom command / toolchain for rustfmt #203

msrd0 opened this issue Aug 16, 2021 · 3 comments

Comments

@msrd0
Copy link
Contributor

msrd0 commented Aug 16, 2021

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.

@Green-Avocado
Copy link
Contributor

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.

@aminya
Copy link
Contributor

aminya commented Dec 2, 2021

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

@jon-chuang
Copy link

jon-chuang commented Feb 23, 2022

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants