vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

Rustfmt failed with wsl

Open thymbahutymba opened this issue 6 years ago • 6 comments

I'm trying to format my code pressing ALT+SHIFT+F but i get the following error

[Error - 10:51:44] Request textDocument/formatting failed.
  Message: Reformat failed to complete successfully
  Code: -32603 

Here the rust configuragion in my setting.json

"rust-client.useWSL": true,
"rust-client.revealOutputChannelOn": "info",
"rust-client.rustupPath": "~/.cargo/bin/rustup",

Using cargo fmt from wsl terminal works correctly. What I'm missing?

thymbahutymba avatar Jun 25 '19 08:06 thymbahutymba

Hey, thanks for the report!

WSL support is deprecated now and Remote - WSL extension should be used instead. Could you try setting it up and seeing if it works there?

Xanewok avatar Jun 29 '19 16:06 Xanewok

With remote - WSL extension, the document format still doesn't work.

chbdetta avatar Jul 06 '19 05:07 chbdetta

Same problem here

thymbahutymba avatar Jul 06 '19 15:07 thymbahutymba

Same issue here. On macOS

robrecord avatar Jul 04 '22 11:07 robrecord

@robrecord your issue seems unrelated (because you're not using WSL), but you should probably try https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer, see https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html.

You'll need to install rustfmt if you don't already have it (rustup component add rustfmt).

lnicola avatar Jul 04 '22 11:07 lnicola

Thank you @lnicola - I appreciate this. I am new to rust.

robrecord avatar Jul 04 '22 17:07 robrecord