[Repo Assist] fix: thread document version through PublishDiagnosticsParams#1526
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
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>
29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Threads the document version through the
PublishDiagnosticsParamssent to the LSP client, resolving a long-standing TODO in the codebase.Root Cause
The LSP spec's
PublishDiagnosticsParamshas aversionfield that clients can use to discard stale diagnostics when the user has already made further edits. Previously, FSAC always sentVersion = None, with a TODO comment noting this gap.The
DiagnosticCollectionalready tracked per-source versions internally (for ordering/de-duplication), but discarded the version when callingsendDiagnostics.Fix
DiagnosticCollection.sendnow computes the maximum version across all diagnostic sources for a URI and passes it tosendDiagnosticssendDiagnosticsaccepts theint optionversion and forwards it asVersion = versionin the LSP publish paramsClearFor),Noneis sent// TODO: providing version would be very usefulcommentTest Status
dotnet build— succeeded with 0 warnings, 0 errorsdotnet fantomas— no formatting changes needed