corrosion: Missing integration of rustfmt

To me it looks like currently there is no way to automatically or semi-automatically do source code formatting with rustfmt.

  • My preferred choice would be to run be able to configure rustfmt as a “Save action”
  • At least I would like to be able to press Ctrl+Shift+F (like for Java) and get the code formatted

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Ok, checking the logs shows:

[t=1562070660321] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","id":"11","method":"textDocument/formatting","params":{"textDocument":{"uri":"file:///home/jreimann/Development/workspace-esp32-rust/rust-esp32-hono/src/main.rs"},"options":{"tabSize":4,"insertSpaces":false}}}
[t=1562070660322] org.eclipse.corrosion.rls to LSP4E:
{"jsonrpc":"2.0","error":{"code":-32603,"message":"Reformat failed to complete successfully"},"id":"11"}

Still I see one enhancement/fix here. If the RLS reports and error like that, that should pop up in the Eclipse error log.

Also: @ctor does the situation improve after a cargo clean?

I wonder, are most of Corrosion’s users building “Hello World” projects,

To be honest, I have the impression you’re currently “most of Corrosion’s users”. Maybe other users face the issue and don’t care reporting…

On 2nd thoughts, I think “format on save” could be a feature in LSP4E, but that would first require the LS “Format” operation to work.