Closed lilyball closed 2 years ago
Playing some more, after a save and more of the canceled by client
lines, waiting long enough will cause it to stop logging those. At this point I could make a trivial edit inside of my fn main()
(inserting a space), or in between my struct Foo { … }
and fn main()
items, but once again, inserting a single space at the end of the file crashed the language server.
It looks like the "index out of bounds" index is in fact the last line in the file.
Similarly, I deleted that blank line, at which point mere cursor interactions on what was now the last line caused panics.
So it looks like the core problem here is any editor interaction involving the last line of the file is panicking.
Thank you for this detailed bug report!
You've definitely hit on an issue with the last line causing problems like "out of bounds" error with Rust Analyzer. I think this issue sounds like a core Nova bug I've heard of elsewhere, so it's not something I can fix. Other extensions have logged the same issue, and it's been mentioned multiple times in their extension developer forum. Panic is aware of the issue, but hasn't stated if a fix is imminent.
I've noticed the canceled by client
log a lot too, so I need to dig into what's causing it. It did seem mostly benign (like maybe from mousing out of an identifier while it was in the middle of providing hover info), but I wanted to be sure when I had time.
Like Code Actions, Panic appears to have fixed this issue in version 9 which was released today. Let me know if anyone still has this issue.
Describe the bug I created a new project with
cargo new foo
, opened it in Nova, and began editing the main.rs file. And the language server keeps crashing on every edit. I restart it, it looks fine, I edit the file, crash.Crash log
``` Rust Analyzer[11:13:31.012000] waiting for cargo metadata or cargo check Rust Analyzer[11:13:31.705000] waiting for cargo metadata or cargo check Rust Analyzer[11:13:31.754000] waiting for cargo metadata or cargo check Rust Analyzer[11:13:32.545000] content modified Rust Analyzer[11:13:33.574000] canceled by client Rust Analyzer[11:13:36.553000] canceled by client Rust Analyzer[11:13:36.670000] canceled by client Rust Analyzer[11:13:45.842000] Panic context: Rust Analyzer[11:13:45.842000] > Rust Analyzer[11:13:45.842000] version: ed4b312fa 2021-10-11 stable Rust Analyzer[11:13:45.842000] request: textDocument/codeAction CodeActionParams { Rust Analyzer[11:13:45.842000] text_document: TextDocumentIdentifier { Rust Analyzer[11:13:45.842000] uri: Url { Rust Analyzer[11:13:45.842000] scheme: "file", Rust Analyzer[11:13:45.842000] cannot_be_a_base: false, Rust Analyzer[11:13:45.842000] username: "", Rust Analyzer[11:13:45.842000] password: None, Rust Analyzer[11:13:45.842000] host: None, Rust Analyzer[11:13:45.842000] port: None, Rust Analyzer[11:13:45.842000] path: "/Volumes/Macintosh%20HD/Users/lily/Desktop/foo/src/main.rs", Rust Analyzer[11:13:45.842000] query: None, Rust Analyzer[11:13:45.842000] fragment: None, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] range: Range { Rust Analyzer[11:13:45.842000] start: Position { Rust Analyzer[11:13:45.842000] line: 5, Rust Analyzer[11:13:45.842000] character: 0, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] end: Position { Rust Analyzer[11:13:45.842000] line: 5, Rust Analyzer[11:13:45.842000] character: 0, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] context: CodeActionContext { Rust Analyzer[11:13:45.842000] diagnostics: [], Rust Analyzer[11:13:45.842000] only: None, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] work_done_progress_params: WorkDoneProgressParams { Rust Analyzer[11:13:45.842000] work_done_token: None, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] partial_result_params: PartialResultParams { Rust Analyzer[11:13:45.842000] partial_result_token: None, Rust Analyzer[11:13:45.842000] }, Rust Analyzer[11:13:45.842000] } Rust Analyzer[11:13:45.842000] Rust Analyzer[11:13:45.842000] thread 'To Reproduce Steps to reproduce the behavior:
cargo new foo
in the terminalfoo
folder into Novasrc/main.rs
Additional information I haven't attempted to reproduce this with a fresh project.
In addition, after collecting that log, I cleared the console, opted to Restart Server, and then noticed that every cursor movement would log another panic (but would not tell me that the language server crashed). Hitting Save informed me of the crash again. I hit Restart Server again, and got
At this point every time I moved the cursor I'd get a line like
I hit Save again and this time it finally showed
Once I saw that, moving the cursor no longer logged anything, and I was able to make a trivial edit without logging too.
However, while writing up this report, after having left it alone for a while, I went back to Nova and inserted a single space at the end of the file, at which point the language server promptly crashed again.
Versions (please complete the following information):