-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PublishDiagnostics not sent when inserting whitespace or comments with Helix #10628
Comments
Based on the asciinema it seems like helix translates the line+column sent by rust-analyzer to an offset from the start of the file once and then reuses it every time the file changes even if changing the length of an earlier line would change this file offset for the original line+column pair. |
Looking at the code I can't find anything that suggests this is indeed the case though. Thisvis the first time I look at it's code though, so I may be missing something. |
I don't think so (though maybe I'm misunderstanding) as the diagnostics should be updated every time there is an LSP event: Though perhaps you meant something like this? Helix won't flush the diagnostics for the buffer and depends upon the LSP sending updated diagnostics to do that. Is Rust-Analyzer (and LSPs in general) not meant to send |
Rust-analyzer only publishes diagnostics when the diagnostics actually change it seems. The file offset doesn't matter, only the line+column pair. I think helix should handle this gracefully as rust-analyzer may take a while for the new publish diagnostics to be sent due to being busy even if it were to sent it at all. I think the fix would be to translate from line+column to file offset every time the file changes, or only use line+column internally. Showing the error requires translating from file offset to line+column anyway, doesn't it? |
Ah I see, that makes sense! |
I can't fully remember but I think the issue was with diagnostics that only get calculated on file save (not simple syntax issues). We get one set of diagnostics from rust-analyzer, and while I had code that would adjust diagnostics positioning according to edits, on each change rust-analyzer would also re-send the original diagnostics with outdated offsets, effectively clobbering the old set. I don't think there's much we can do there other than track what the original diagnostics were before remapping and then de-duplicate. |
Vscode doesn't do this.
Yeah, this is a known issue in rust-analyzer (#8836). In vscode it will keep showing the outdated location.
For the |
Ah okay, yeah it's the same issue then.
Yeah we accomplish this via the position mapping. The edits are OT-like so we're able to transform selections from offsets in the old document to the new one. |
helix-editor/helix#701
Log:
The file is the same as the one in the video in the linked issue. I'm assuming it's something we're doing wrong, but I don't know what.
The text was updated successfully, but these errors were encountered: