-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Panic on trying to highlight new file (even when empty) #15907
Comments
So to clarify : Is the newly created file called |
Yes, hashbucket is the file newly added. And sorry about that, I was just linking it because it technically matched the provided description. |
No worries at all, just saying. and content-wise you say that the file is empty, interesting. the reason I am asking is that the error stems from our parser not being able to find a token at a given offset and this is strange. Maybe you could share only the first couple of lines of |
I’ve deleted the file in the attempts to get it to work but it failed with stuff like (entire contents of the file, plus or minus a couple empty lines) struct HashBucket {}
impl HashBucket {} and variations. |
Some additional context is that it would pop up about something like detecting the |
So there are two possible things that are going on here, either vscode was sending a highlight request with an out of bounds offset, or we were trying to retry an old highlight request after a file got modified which means the offsets are wrong, The first one is a VSCode bug, the second case ours. Given the description of the issue, it seems to be the forme rthough. (nevertheless we should catch this in some way) |
On it. But I thought it points to an error of the latter kind which must be handled in some other way. So I am just going to return |
If invalid, we either need to fail the request, or better try to fix up any offsets inside it which is a lot harder and has to be done on a per request basis. So the former should suffice for the time being. |
Oh, something I realized that's definitely worth noting is that the issue stopped happening when I used |
fix: Don't retry position relient requests and version resolve data Fixes rust-lang/rust-analyzer#15907 Fixes rust-lang/rust-analyzer#14839 Fixes rust-lang/rust-analyzer#16536
rust-analyzer version: rust-analyzer version: 0.3.1730-standalone (416e9c8 2023-11-12)
rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)
relevant settings: No settings that I can think of being relevant
Adding a new file to a project causes rust-analyzer to fail to analyze that file and print a panic to output. This happens both when the file is empty and when rerunning with code in the file.
The text was updated successfully, but these errors were encountered: