Repository navigation
fix: send the result ID of the last pulled report as previousResultId - #1735
Merged
angelozerr merged 1 commit intoOct 20, 2026
Conversation
A textDocument/diagnostic pull never sent previousResultId, so a server could not answer that the result it gave is still accurate (an unchanged report), and had to send the full report each time; LSP4IJ already handles unchanged reports. The synchronizer, whose lifetime is one connection of one document, keeps the result ID of the last report it applied, full or unchanged, and sends it with the next pull. A report that is discarded, because the document changed or the synchronizer was retired while the request was pending, does not change it: an unchanged reply to that ID would vouch for diagnostics that were never applied. Closing and reopening the document starts with a new synchronizer, so with no previous result. New PullResultIdTest: the first pull sends no previousResultId; after a full report "result-1", the next pull sends it; after an unchanged report "result-2", the diagnostics of the first report stay, and the next pull sends "result-2". On main the second pull sends none (expected:<result-1> but was:<null>). MockTextDocumentService records the diagnostic requests, and the synchronizer has a @testonly accessor for the kept result ID. ./gradlew check: 604 tests, 0 failures, the 3 existing skips.
Contributor
|
LGTM, thanks @lagergren ! |
This was referenced Oct 28, 2026
angelozerr
pushed a commit
that referenced
this pull request
Nov 4, 2026
* docs: describe the 0.30.0 LSP and DAP changes that the docs miss Several changes merged for 0.30.0 changed behavior that the docs describe, or added behavior that they don't. LSPSupport.md still said that pull diagnostics don't support related documents, which #1723 changed. LSP: - LSPSupport.md, Pull Diagnostics: previousResultId, and the relatedDocuments of either kind of report (#1723, #1735), in place of "It doesn't support the related documents." - LSPSupport.md, Inline Completion: the trigger kind and the selected completion item (#1715). - LSPSupport.md, Signature Help: the retrigger, the active parameter of each signature, and signatures without parameters (#1712, #1734). - LSPSupport.md, Formatting: a file without an open editor (#1707). - LSPSupport.md, new Did Change Watched Files section: the directories outside the project that watchers name, and the watchers of a stopped server (#1742). The support list links to it. - UserGuide.md, Formatting: the Do not format patterns (#1817). - UserDefinedLanguageServer.md, Configuration tab: null properties (#1710, #1847) and invalid JSON (#1828). - DeveloperGuide.md, Workspace Configuration: null members of createSettings() (#1710, #1847). DAP, dap/UserGuide.md: - Exception breakpoint: the hint built from exceptionInfo (#1761). The screenshot of the stop at the exception moves back after the example it shows; the Smart Step Into section had come between them. - Large variables: a page with fewer children than asked for is the last one (#1851). Validation: each statement was checked against the code at d1a281d: DocumentContentSynchronizer.refreshPullDiagnostic, LSPInlineCompletionProvider.createParams, LSPParameterInfoHandler, ClientCapabilitiesFactory, AbstractLSPFormattingService.canFormat, LSPFormattingSupport, FileSystemWatchRoots, LanguageServerPanel .validateJsonFields, JsonSettingsTypeAdapterFactory, DAPClient.getExceptionHint and DAPVariableChildren. The other changes merged for 0.30.0 are already documented, by their own PRs, #1784 and #1810, or change nothing that the docs describe. Limits: docs only, no new screenshots, no build run. * docs: say that the JSON fields of a language server are read leniently CodeRabbit noted that "must be valid JSON" is stricter than what LSP4IJ accepts. The dialog's check (LanguageServerPanel.jsonError, JsonParser.parseString) and the readers at run time (SettingsHelper.parseJson, JsonParser.parseReader for the initialization options, experimental and installer, Gson.fromJson for the client configuration and workspace folders) all read leniently. The paragraph now says which JSON is accepted and which isn't. Validation: probed Gson 2.15.0's JsonParser.parseString and Gson.fromJson. Both accept // and /* */ and # comments, unquoted names and single-quoted strings, and both reject a trailing comma, a missing brace and an unescaped backslash, such as in C:\Users.
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.
Pulled diagnostics now send
previousResultId, the result ID of the last report applied to the document, so that a server can answer that its result is still accurate.Problem
DocumentContentSynchronizer.refreshPullDiagnosticnever setpreviousResultId. EverytextDocument/diagnosticrequest therefore asked for a full report, and a server could not answer with anunchangedreport, which LSP4IJ already handles.Why this is a fix
previousResultId: The result id of a previous response if provided."resultId: "An optional result id. If provided it will be sent on the next diagnostic request for the same document."resultId: "A result id which will be sent on the next diagnostic request for the same document."Change
previousResultIdwith the next pull of its document.unchangedreply to that ID would vouch for diagnostics that were never applied.Validation
New
PullResultIdTest:mainpreviousResultIdpreviousResultIdresult-1expected:<result-1> but was:<null>)result-1unchangedreport withresult-2result-2MockTextDocumentServicerecords the diagnostic requests, and the synchronizer has a@TestOnlyaccessor for the kept result ID: the test waits for anunchangedreport to be applied, which shows nothing otherwise../gradlew check: 604 tests, 0 failures, the 3 existing skips.Not included
relatedDocumentsare not kept, since those documents are not pulled through this synchronizer.workspace/diagnosticis not part of this.