rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.13k stars 1.58k forks source link

rust-analyzer: -32603: Invali-d offset LineCoL { line: 82, cot: a (Line index Length: 2073) #17430

Closed CaamVilvactDJavu closed 2 months ago

CaamVilvactDJavu commented 3 months ago

Screenshot 2024-06-16 084838

How to fix that Error, This Error always bothers me

roife commented 3 months ago

What version of the rust-analyzer server are you using? Does your code contain any wide characters? A minimal reproducible example would be helpful for reproducing the issue.

CaamVilvactDJavu commented 3 months ago

What version of the rust-analyzer server are you using? Does your code contain any wide characters? A minimal reproducible example would be helpful for reproducing the issue.

I'm using rust-analyzer 1.78.0 (9b00956 2024-04-29) which I installed via brew. The rust analyzer is running, but the error is bothering me. There are no errors in my coding. but it seems to be an error from the rust-analyzer. What do you mean by wide characters

Veykril commented 3 months ago

What text editor are you using / what lsp integration. And the next time you see that error, please check what LineCol info it shows and how many lines the document has (that is whether the info shown is actually out of bounds for the document).

CaamVilvactDJavu commented 3 months ago

I'm using LazyVim. Howdo you see the LineCol?

Veykril commented 3 months ago

it is in the error message

CaamVilvactDJavu commented 3 months ago

it is in the error message

It's not my error code. It's from rust-analyzer.

nolibc commented 3 months ago

I think I figured something out.

After changing the version of rust-analyzer to multiple different versions with a stock config, I concluded that the issue is at the very least not directly a result of rust-analyzer. I was using the latest version of neovim 0.10 and found out that changing to any previous version fixed this issue entirely.

Not sure if this will be the case for everyone, but seeing as other comment talk about rust-analyzer working fine on other editors such as vscode, I would guess this to be the case. Perhaps the lastest neovim version changed something in regards to how communication with the LSP (or the language server to the LSP) works and thus it now no longer tracks the offset correctly. Not sure which is the case.

mfontanini commented 2 months ago

@bunkrat do you know if this is being tracked in the neovim issue tracker somewhere? I'm hitting this constantly and it's making my environment borderline unusable.

nolibc commented 2 months ago

@mfontanini I don't believe so. As far as I know no one is really sure what is causing the issue yet. The closest thing I found in neovim's issue tracker is issue neovim#29500, but I'm not entirely sure how related that is to this specific issue. There does still seem to be discussions about it on rust-lang#17289 though.

I personally don't use LSP anymore, but since you do, you might consider downgrading your nvim to release-0.9 for the time being.

Veykril commented 2 months ago

I'll close this as a duplicate of https://github.com/rust-lang/rust-analyzer/issues/17289