Skip to content

fix: force load of language server settings in the lsp console factory - #991

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:lsp_settings_force_loading
Apr 24, 2025
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:lsp_settings_force_loading

Conversation

@angelozerr

Copy link
Copy Markdown
Contributor

fix: force load of language server settings in the lsp console factory

@angelozerr
angelozerr force-pushed the lsp_settings_force_loading branch 2 times, most recently from 15bf365 to 4a6e935 Compare April 24, 2025 08:52
@angelozerr
angelozerr force-pushed the lsp_settings_force_loading branch from 4a6e935 to db9734f Compare April 24, 2025 09:16
@angelozerr
angelozerr merged commit 25ff61d into redhat-developer:main Apr 24, 2025
@angelozerr angelozerr added bug Something isn't working good first issue Good for newcomers and removed good first issue Good for newcomers labels Apr 24, 2025
@angelozerr angelozerr added this to the 0.13.0 milestone Apr 24, 2025
@angelozerr angelozerr self-assigned this Apr 24, 2025
angelozerr pushed a commit that referenced this pull request Oct 19, 2026
Fixes #1722. Two bugs together kept the diagnostics of related documents
from ever being applied:

- LSP4J 1.0.0 cannot parse a textDocument/diagnostic reply with
  relatedDocuments: "Ambiguous Either type: token BEGIN_OBJECT matches both
  alternatives" (eclipse-lsp4j/lsp4j#990, fixed in eclipse-lsp4j/lsp4j#991,
  not yet released). In LSP4IJ's test harness such a pull never completed.
- DocumentContentSynchronizer.refreshPullDiagnostic applied relatedDocuments
  only for an unchanged report, and dropped them from a full one.

refreshPullDiagnostic now applies the related documents of both report kinds,
through updateRelatedPullDiagnostics. RelatedDocumentsTypeAdapterFactory,
registered in JSONUtils.configureCompatibilityAdapters beside the other LSP4J
compatibility adapters, reads each relatedDocuments value by its kind, as LSP4J
does for the report itself. It only matches the exact field type, so LSP4J's
own field adapter takes precedence once LSP4IJ uses a release with #991, and
the factory can then be removed.

Validation:
- New PullRelatedDocumentsTest: the mock answers the opened file's pull with a
  full report, and in a second test an unchanged one. Each carries diagnostics
  for a second, closed file, which must be stored.
- New RelatedDocumentsSerializationTest round-trips such a
  textDocument/diagnostic response through MessageJsonHandler with
  configureCompatibilityAdapters.
- With neither part, or with only the handling fix, all three tests fail. With
  only the adapter, the unchanged-report and serialization tests pass and the
  full-report test fails. With both, all pass.
- ./gradlew check: 579 tests, 0 failures, 3 existing skips.

Signed-off-by: Marcus Lagergren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant