vscode-rust
vscode-rust copied to clipboard
RLS mode auto format fails with Code: -32601
Version of VSCode: 1.12.1 Version of the extension: 0.3.14 OS: Ubuntu 16.04
Description: "Format Document" does not work in RLS mode.
Output of the "Rust logging" channel:
[Error - 11:47:41 PM] Request textDocument/rangeFormatting failed.
Message: Reformat failed to complete successfully
Code: -32601
Maybe this is not supported yet in RLS mode? I also have "editor.formatOnSave": true
in my settings and a rls.toml file with unstable_features = true
but the Rust code is not automatically formatted on save.
Set "rust.rls"
to { "env": { "RUST_LOG": "rls=debug" }
.
After that post the output of the Rust Language Server output channel.
Right now formatting support in RLS is behind the "unstable features" flags. Have you enabled this flag? See here how to configure RLS in your project. It should be as simple as adding a file called "rls.toml" with the following content:
unstable_features = true
Also, relevant cross-issues: rust-lang-nursery/rls#242 rust-lang-nursery/rls#3
RLS is so unstable as to be unusable. Going to racer for now. Really racer should be the default and RLS the cutting edge option.
Attached is the output with the rls=debug option.
I don't see anything more verbose about the error in there.
Excerpt:
DEBUG:rls::actions: build "/home/klausi/workspace/rustnish"
DEBUG:rls::actions: reformat: format_input failed: has errors, summary = Summary { has_operational_errors: false, has_parsing_errors: false, has_formatting_errors: true, has_diff: false }
DEBUG:rls::server: response: "Content-Length: 101\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":3,\"error\":{\"code\":-32601,\"message\":\"Reformat failed to complete successfully\"}}"
[Error - 8:55:16 PM] Request textDocument/formatting failed.
Message: Reformat failed to complete successfully
Code: -32601
DEBUG:rls::actions: build - Success
I switched back to legacy mode which mostly works in the meantime, described here: https://klausi.github.io/rustnish/2017/05/28/using-visual-studio-code-for-rust-on-ubuntu.html
Still getting this error.. It actually does reformat, but complains too :/
Edit: it could be that it throws this error when rustfmt succeeds, but throws warnings like line overflow? Edit: yup, confirmed that this is the case.
I'm still getting this error.
Just starting learning rust and the formatting code does not work on mac. It's 2017 issue and still happening in 2019, anyone already know the workaround? Thanks.
[Error - 11:44:26 AM] Request textDocument/formatting failed.
Message: Reformat failed to complete successfully
Code: -32603
Right it is still unusable.
This extension hasn't been updated in two years, please use rust-lang/rls-vscode.
Right, but it still has some problems and I am using an extension called rust-assist which provides the functionalitites which rls-vscode has bugs.