Skip to content

Answer document diagnostic pulls with the current text's diagnostics - #563

Open
stubbedev wants to merge 1 commit into
PHPantom-dev:mainfrom
stubbedev:fix-stale-pull-diagnostics
Open

stubbedev wants to merge 1 commit into
PHPantom-dev:mainfrom
stubbedev:fix-stale-pull-diagnostics

Conversation

@stubbedev

@stubbedev stubbedev commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #562

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, examples/)
  • I have updated the config schema (config-schema.json)
  • I have added/updated tests to cover my changes
  • If I used AI tools, I have reviewed what they produced and can explain
    the changes and why they are needed.
  • I have read through any AI-generated text, especially documentation,
    the changelog, and other user-facing content, and removed or corrected
    anything inaccurate, unclear, or unnecessary.

@stubbedev
stubbedev force-pushed the fix-stale-pull-diagnostics branch from e8e8ed7 to f603a36 Compare November 9, 2026 14:15
@codecov-commenter

codecov-commenter commented Nov 9, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Neovim sends textDocument/diagnostic right after every didChange. The
edit is parsed on a background task that only then queues the file's
diagnostic pass, so that pull was answered from the cache of the
previous text, as `unchanged` when the client echoed the last resultId.
The fresh set was announced with workspace/diagnostic/refresh, which
Neovim answers with a workspace pull only and ignores for buffers it
pulls one document at a time, so the stale diagnostics stayed until the
buffer was reloaded. A pull sent while the project was still being
indexed at startup was answered with an empty set the same way.

A document pull now waits, without computing anything on the request
path, until the diagnostics reflect the document's current text: for
startup to finish, for the edit's parse (tracked from didChange until
the parse has queued the pass), for the queued pass, and for the pass
in flight. Each stage hands the URI on before letting go of it, so the
wait never sees a gap. A newer pull for the same document releases the
held one, so a typing burst holds at most one request per document;
cancellation, shutdown and the worker stopping release held pulls too.

Closes PHPantom-dev#562
@stubbedev
stubbedev force-pushed the fix-stale-pull-diagnostics branch from f603a36 to 180ac27 Compare November 9, 2026 14:49

This branch has not been deployed

No deployments
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.

Stale diagnostics in Neovim: pull right after didChange answers unchanged, and the refresh doesn't re-pull the document

2 participants