Stream: general

Topic: rust-fmt from vs code, on save


zeroexcuses (May 07 2020 at 14:32, on Zulip):

Is there a way, to tell vs code, on save, to execute rust-fmt ?

Laurențiu Nicola (May 07 2020 at 15:25, on Zulip):

"editor.formatOnSave": true and make sure rustfmt is installed. You'll also need rust-analyzer (or RLS).

zeroexcuses (May 07 2020 at 15:29, on Zulip):
  "editor.formatOnSave": true

is working because settings.json is getting reformatted on save

rustfmt is installed because it works fine from IntelliJ/Rust on save

however, saving a *.rs file (in the same workspace that worked from IntelliJ) is not triggering a reformat

zeroexcuses (May 07 2020 at 15:29, on Zulip):

How does vscode know to call |"rustfmt" for *.rs files ?

zeroexcuses (May 07 2020 at 15:30, on Zulip):

rust-fmt works now on *.rs files

Laurențiu Nicola (May 07 2020 at 17:40, on Zulip):

Code doesn't call rustfmt, it asks the language server to format the file. rust-analyzer sometimes gets a bit stuck and doesn't get to run it like in https://github.com/rust-analyzer/rust-analyzer/issues/4054, but it should work.

Last update: Jun 05 2020 at 21:50UTC