editor-rs / vscode-rust

Rust for Visual Studio Code
MIT License
474 stars 62 forks source link

Silent formatting failures when rustfmt can't fix a problem #351

Open acdha opened 7 years ago

acdha commented 7 years ago

Version of VSCode: 1.15.1 Version of the extension: 0.2.2 OS: macOS 10.12.6

Description:

I ran into a problem where it seemed like formatting was broken – “Format Document” and formatOnSave did nothing and there was no UI indication that anything had gone wrong. A quick rustfmt on the command-line showed a problem which couldn't be fixed automatically (in this case a long FIXME: comment in a struct defintion):

Rustfmt failed at …/src/main.rs:74: line exceeded maximum length (maximum: 100, found: 118) (sorry)

Output of the "Rust logging" channel:

[Error - 3:51:34 PM] Request textDocument/formatting failed.
  Message: Reformat failed to complete successfully
  Code: -32603 

So obviously this could be detected by thinking to check the RLS logging channel but it'd be nice if there was some UI badging even if it was something more basic than badging the lines which couldn't be formatted.