Closed creese closed 8 months ago
I've been experimenting with Eglot as my primary tool and ran into an unexpected error. I'd appreciate any insights or potential solutions.
Here's a step-by-step of what I did:
cargo new hello_cargo
println!
println!()
electric-pair-local-mode
*Messages*:
*Messages*
jsonrpc-error: "request id=7 failed:", (jsonrpc-error-code . -32603), (jsonrpc-error-message . "request handler panicked: assertion failed: !!text[usize::from(position.offset)..].starts_with(char_typed)"), (jsonrpc-error-data)
eglot-stderr-buffer:
eglot-stderr-buffer
Panic context: > version: 0.0.0 (6572ec8d9 2023-10-15) request: textDocument/onTypeFormatting DocumentOnTypeFormattingParams { text_document_position: TextDocumentPositionParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Source/hello_cargo/src/main.rs", query: None, fragment: None, }, }, position: Position { line: 3, character: 14, }, }, ch: "(", options: FormattingOptions { tab_size: 8, insert_spaces: true, properties: {}, trim_trailing_whitespace: None, insert_final_newline: Some( true, ), trim_final_newlines: Some( true, ), }, } thread 'LspServer' panicked at crates/rust-analyzer/src/handlers/request.rs:339:8: assertion failed: !!text[usize::from(position.offset)..].starts_with(char_typed) stack backtrace: 0: rust_begin_unwind at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5 1: core::panicking::panic_fmt at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14 2: rust_analyzer::handlers::request::handle_on_type_formatting 3: std::panicking::try 4: rust_analyzer::dispatch::RequestDispatcher::on_sync 5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::on_request 6: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run 7: rust_analyzer::main_loop::main_loop 8: rust_analyzer::run_server note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Has anyone encountered a similar issue or have suggestions for a fix?
For reference, here's my configuration:
(add-hook 'rust-ts-mode-hook 'eglot-ensure) (add-hook 'prog-mode-hook 'electric-pair-local-mode)
Thanks!
Converting to discussion. Not a MRE.
I've been experimenting with Eglot as my primary tool and ran into an unexpected error. I'd appreciate any insights or potential solutions.
Here's a step-by-step of what I did:
cargo new hello_cargo
.println!
, add anotherprintln!
.println!()
, there is no error.electric-pair-local-mode
.println!
.println!()
, the following error message appears:*Messages*
:eglot-stderr-buffer
:Has anyone encountered a similar issue or have suggestions for a fix?
For reference, here's my configuration:
Thanks!