rust-lang / vscode-rust

Rust extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Other
1.39k stars 167 forks source link

Rustfmt failed with wsl #610

Open thymbahutymba opened 5 years ago

thymbahutymba commented 5 years ago

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?

Xanewok commented 5 years ago

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?

chbdetta commented 5 years ago

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

thymbahutymba commented 5 years ago

Same problem here

robrecord commented 2 years ago

Same issue here. On macOS

lnicola commented 2 years ago

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

robrecord commented 2 years ago

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