x/tools/gopls: diagnostics version is reused for same diagnostic #36476
Comments
As @leitzler has just linked, when we fixed |
Thanks for reporting this issue! I think this issue must have existed for a while. It's definitely a caching issue, and we haven't noticed it in VS Code because VS Code will actually go back to old file versions if they are the same. For example, if a file's version 1 contains "foo", and then version 2 contains "fo", and then the next version goes back to "foo", VS Code will send version 1 for that second |
Just a note, after https://golang.org/cl/213820/ was merged (tested with That has impact on this issue as it is now a bit more severe when |
I'm fairly certain we're still seeing this problem as of a7a6caa Starting with:
I then edit to take the file to:
Then delete the
In my manual testing just now, this either leaves
A Note the last publishing of diagnostics is:
Despite the fact that after that there are versions of the file, namely 5, 7 and 9, where there is again an error in the file (albeit the same error that was first introduced in version 3) |
Change https://golang.org/cl/214418 mentions this issue: |
Change https://golang.org/cl/214422 mentions this issue: |
|
Just to confirm, per @leitzler's edit to that previous message, everything appears to be working as far as this test is concerned. Thanks for the fix! |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Open a
main.go
with the following content (no errors/warnings):gopls
sends diagnostics Version 1 with no diagnostics:Then I add a
a
insidefunc main()
:That triggers a
didChange
togopls
, andgopls
responds with Version 2 of the diagnostics:I remove the
a
again, triggering anotherdidChange
(Version 3) togopls
and at this point I get Version 1 back again:I re-add
a
at the same position again, and get Version 2 of the diagnostics:Repeat:
If I then add
b
instead,gopls
responds with the correct version:What did you expect to see?
A new version each time that corresponds to the
didChange
.The text was updated successfully, but these errors were encountered: