Skip to content

Conversation

@rchl
Copy link
Member

@rchl rchl commented Oct 2, 2025

Somehow I still keep running into outdated diagnostics ;) I've identified one more problem.

When the response for pull diagnostic comes back, in SessionBuffer._on_document_diagnostic_async the version can be 5 (for example) but by the time the code gets to SessionBuffer.on_diagnostics_async the view.change_count() can increase. Since we didn't pass the actual diagnostics version to SessionBuffer.on_diagnostics_async, we assumed that those diagnostics are for the latest version of the view (6 in this example) and then never requested the more recent diagnostics (actual version 6 diagnostics) later. Fix by passing the actual version of the diagnostics around so that we never show outdated diagnostics due to not getting latest diagnostics.

Also reset _diagnostics_version on diagnostics request getting canceled. This might not make any difference in practice since if we did cancel the request then it likely means that the view version has changed and we wouldn't ignore next request anyway but in any case, this change feels right.

@rchl
Copy link
Member Author

rchl commented Oct 2, 2025

Will look into the failing test tomorrow.

@rchl rchl changed the title Fix more cases of seeing outdated diagnostics Fix more cases of outdated diagnostics Oct 3, 2025
@rchl rchl changed the title Fix more cases of outdated diagnostics Fix another case of outdated diagnostics Oct 3, 2025
@rchl rchl merged commit 96b18e6 into main Oct 4, 2025
8 checks passed
@rchl rchl deleted the fix/diagnostics branch October 4, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants