-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Possible synchronisation issue causes nonsense syntax errors #6402
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
Comments
Can you attach a screen shot of the problems pane next time this happens? It would be useful to know if these are |
Are you sure you're getting There's no way to dump the RA state (except maybe by using the "show syntax tree" command), but I guess it wouldn't be too helpful even if we were to implement it. What would help here would be a LSP trace that we could replay, but most people would probably not want to share it. The incremental sync might also be a good fuzzing target. |
It could theoretically be combined with a tool to minimize the trace to the bare minimum necessary to reproduce the issue. By for example filtering out read-only requests and collapsing write requests. This tools should work on UTF-16 text to rule out any issues caused by the UTF-16 to UTF-8 conversion. And in addition allowing for an easy way to inspect what the trace contains to see if it contains anything sensitive. |
Well, it's a trace of basically every key press in the editor, it's safe to assume that it's sensitive. |
That's why I said that there should be a tool to minimize the trace by for example collapsing write requests like key presses. This would remove most of the later deleted code from the trace. |
Ah in that case no - at the point when RA was reporting errors I ran
I think that would be a cool feature. You're right I probably couldn't share it, but if it were a text based format I could maybe edit out all the sensitive bits. |
We can't load it directly, but you can -- in principle -- enable LSP tracing ( |
So I think I was looking in the wrong place at the logs, anyway this happened again and I get this backtrace:
Note that I wasn't actually editing |
Yeah, that's a tough one. I think what happens is that:
If you see this again, try to check if it was preceded by a crash. Fixing the diagnostic would have prevented your issue, but it can crash the same way when you open a file or invoke "find all references" on the problematic item. |
#5495 is fixed and our fixes are now lazy, I suppose we can close this. |
I unfortunately don't have a way to reproduce this, but within the last couple of weeks I have noticed a new issue - sometimes when I make edits and save the file to trigger
cargo check
it gives me nonsensical syntax errors. This didn't used to happen. Editing a bit more and saving the file does not help. Reloading the window does.It feels a lot like Rust-analyzer's internal representation of the code is getting out of sync with VSCode's representation. I have written a couple of language servers and I know the incremental text changing bit is hard to get right - maybe an obscure bug there.
Is there any way to get rust-analyzer to dump what it thinks the current state of a file is?
The text was updated successfully, but these errors were encountered: