Skip to content

fix: forget diagnostic result IDs when clearing diagnostics for a URI - #3070

Merged
rchl merged 1 commit into
mainfrom
fix/clear-diagnostic-result-ids
Oct 12, 2026
Merged

rchl merged 1 commit into
mainfrom
fix/clear-diagnostic-result-ids

Conversation

@rchl

@rchl rchl commented Oct 11, 2026

Copy link
Copy Markdown
Member

When a view of a file outside of the workspace folders is closed, SessionBuffer._on_before_destroy clears the pull diagnostics stored for its URI, but the result ID from the last textDocument/diagnostic response was kept in Session.diagnostics_result_ids.

When the file is opened again, the request carries that previousResultId. The server can then reply with an unchanged report, which reuses the stored diagnostics, but those were already cleared, so no diagnostics are shown until the file changes.

Session.clear_diagnostics_for_uri now also drops the result IDs for that URI, so the next request gets a full report.

This also seems to be the cause of the intermittent UvTestsuite.test_diagnostics (LSP-ruff) timeouts in lsp_utils CI, e.g. https://github.com/sublimelsp/lsp_utils/actions/runs/38169487011. The test closes and reopens the test file, and it fails whenever the first pull diagnostics response arrives before the close.

Assisted-By: Claude Code:claude-opus-5-5

When a view for a file outside of the workspace folders is closed, its
pull diagnostics are cleared but the stored result ID was kept. On reopen
the request carried that previousResultId, the server could reply with an
unchanged report, and no diagnostics were shown.

Assisted-By: Claude Code:claude-opus-5-5
@rwols
rwols requested a review from jwortmann October 11, 2026 20:14
@rchl

rchl commented Oct 11, 2026 •

Copy link
Copy Markdown
Member Author

I admit I never had good understanding of the whole diagnostics logic so I'm relying mainly on AI here doing good job (and @jwortmann's reviewing)

@jwortmann jwortmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me.

@rchl
rchl merged commit ae3d5d3 into main Oct 12, 2026
9 checks passed
@rchl
rchl deleted the fix/clear-diagnostic-result-ids branch October 12, 2026 16:36
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.

2 participants