Skip to content

[Repo Assist] fix: thread document version through PublishDiagnosticsParams#1526

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-diagnostic-version-tracking-20260410-3a3dbcc81a45ceff
Draft

[Repo Assist] fix: thread document version through PublishDiagnosticsParams#1526
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-diagnostic-version-tracking-20260410-3a3dbcc81a45ceff

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Threads the document version through the PublishDiagnosticsParams sent to the LSP client, resolving a long-standing TODO in the codebase.

Root Cause

The LSP spec's PublishDiagnosticsParams has a version field that clients can use to discard stale diagnostics when the user has already made further edits. Previously, FSAC always sent Version = None, with a TODO comment noting this gap.

The DiagnosticCollection already tracked per-source versions internally (for ordering/de-duplication), but discarded the version when calling sendDiagnostics.

Fix

  • DiagnosticCollection.send now computes the maximum version across all diagnostic sources for a URI and passes it to sendDiagnostics
  • sendDiagnostics accepts the int option version and forwards it as Version = version in the LSP publish params
  • When clearing all diagnostics for a file (ClearFor), None is sent
  • Removes the // TODO: providing version would be very useful comment

Test Status

  • dotnet build — succeeded with 0 warnings, 0 errors
  • dotnet fantomas — no formatting changes needed

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@7ee2b60744abf71b985bead4599640f165edcd93

The LSP spec allows PublishDiagnosticsParams to include the document
version for which diagnostics were computed. Clients can use this to
discard stale diagnostics when the user has already made further edits.

Previously the version was always None (a TODO existed noting this gap).
This change:
- Updates DiagnosticCollection.send to compute the max version across
  all diagnostic sources for a given URI and pass it to sendDiagnostics
- Updates sendDiagnostics to accept and forward the version
- Removes the TODO comment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants