This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
[regression] "code":-32603,"message":"Reformat failed to complete successfully" #1397
Closed
Description
This error is generally emitted when there is a typo in the code causing a compilation error but also happens on "clean" code in rare cases. rustfmt
is able to deal with those typos and format the code correctly, while RLS fails.
Minor errors (ie typo in ident) should not cause formatting to fail. Those errors are common during refactoring while one needs to keep the code tidy and formatted to be able to reason about it.
rustfmt
run from the command line does work in these cases.
This behaviour was introduced in a recent update and has heavily disrupted my workflow. Error was not present in rls 1.34.0 (0d6f53e 2019-02-14)
If this is deemed a feature, please introduce a config option to disable it.
Trivial repro:
Cargo.toml
[package]
name = "test_format"
version = "0.1.0"
authors = ["Nicola Orrù <nigu.orru@gmail.com>"]
[dependencies]
src\main.rs
fn main() {
const i: i32 = 0.5;
println!("Hello, world!");
}
[t=1555338926023] LSP4E to org.eclipse.corrosion.rls:
{"jsonrpc":"2.0","id":"60","method":"textDocument/formatting","params":{"textDocument":{"uri":"file:[...]src/main.rs"},"options":{"tabSize":4,"insertSpaces":false}}}
[t=1555338926023] org.eclipse.corrosion.rls to LSP4E:
{"jsonrpc":"2.0","error":{"code":-32603,"message":"Reformat failed to complete successfully"},"id":"60"}
$ rls --cli
Initializing (look for `progress[done:true]` message)...
> 1: InitializeResult {
capabilities: ServerCapabilities {
text_document_sync: Some(
Kind(
Incremental,
),
),
hover_provider: Some(
true,
),
completion_provider: Some(
CompletionOptions {
resolve_provider: Some(
true,
),
trigger_characters: Some(
[
".",
":",
],
),
},
),
signature_help_provider: None,
definition_provider: Some(
true,
),
type_definition_provider: None,
implementation_provider: Some(
Simple(
true,
),
),
references_provider: Some(
true,
),
document_highlight_provider: Some(
true,
),
document_symbol_provider: Some(
true,
),
workspace_symbol_provider: Some(
true,
),
code_action_provider: Some(
Simple(
true,
),
),
code_lens_provider: Some(
CodeLensOptions {
resolve_provider: Some(
false,
),
},
),
document_formatting_provider: Some(
true,
),
document_range_formatting_provider: Some(
false,
),
document_on_type_formatting_provider: None,
rename_provider: Some(
Simple(
true,
),
),
color_provider: None,
folding_range_provider: None,
execute_command_provider: Some(
ExecuteCommandOptions {
commands: [
"rls.applySuggestion-21192",
"rls.deglobImports-21192",
],
},
),
workspace: None,
},
}
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","title":"Building"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","message":"test_format cfg(test)","title":"Building"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","message":"test_format","title":"Building"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"done":true,"id":"progress_1","title":"Building"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_0","title":"Indexing"}}
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"E0308","message":"mismatched types\n\nexpected i32, found floating-point number\n\nnote: expected type `i32`\n found type `{float}`","range":{"end":{"character":23,"line":1},"start":{"character":20,"line":1}},"severity":1,"source":"rustc"}],"uri":"file:///home/norru/Projects/ivt/test_format/src/main.rs"}}
{"jsonrpc":"2.0","method":"window/progress","params":{"done":true,"id":"progress_0","title":"Indexing"}}
> format src/main.rs
{"jsonrpc":"2.0","error":{"code":-32603,"message":"Reformat failed to complete successfully"},"id":2}
>
Metadata
Metadata
Assignees
Labels
No labels