Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

RLS mode auto format fails with Code: -32601 #239

Open
klausi opened this issue May 15, 2017 · 11 comments
Open

RLS mode auto format fails with Code: -32601 #239

klausi opened this issue May 15, 2017 · 11 comments

Comments

@klausi
Copy link

klausi commented May 15, 2017

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.

@KalitaAlexey
Copy link
Member

Set "rust.rls" to { "env": { "RUST_LOG": "rls=debug" }.
After that post the output of the Rust Language Server output channel.

@Enet4
Copy link

Enet4 commented May 16, 2017

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/rls#242 rust-lang/rls#3

@DanielJoyce
Copy link

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.

@klausi
Copy link
Author

klausi commented May 16, 2017

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

rls-debug.txt

@klausi
Copy link
Author

klausi commented May 30, 2017

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

@marcusklaas
Copy link

marcusklaas commented Aug 17, 2017

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.

@nox
Copy link

nox commented Jun 19, 2019

I'm still getting this error.

@iambudi
Copy link

iambudi commented Jul 13, 2019

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

@xtlsoft
Copy link

xtlsoft commented Jul 15, 2019

Right it is still unusable.

@Systemcluster
Copy link

This extension hasn't been updated in two years, please use rust-lang/rls-vscode.

@xtlsoft
Copy link

xtlsoft commented Jul 15, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants