Skip to content

feat: show a late hover reply in a file whose languages register no documentation provider - #2130

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/show-late-documentation-when-the-language-documents-nothing
Nov 23, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/show-late-documentation-when-the-language-documents-nothing

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #2129

What

Since #2020, Quick Documentation waits 500 ms at most for the textDocument/hover reply in a file that isn't a plain text, TextMate or abstract file type file, and shows a later reply only the next time at the same offset. In a file whose languages register no documentation provider, there is no documentation of the file's own for a target to hide. Still, the first Ctrl+Q showed nothing when the server took longer.

Change

LSPDocumentationTargetProvider.hasNoDocumentationOfItsOwn also counts a file whose languages register no documentation provider (registersNoDocumentationProvider). Such a file gets the LSPPendingHoverDocumentationTarget, as a plain text file does: the popup opens and shows the reply when it comes.

  • The check reads LanguageDocumentation.INSTANCE.allForLanguage for each language of the file's view provider. It is false if any of them has a provider, such as the HTML of a template file.
  • allForLanguage leaves out the providers registered for any language, LSP4IJ's LSPDocumentLinkDocumentationProvider and LSPSemanticTokenDocumentationProvider among them.
  • LSPFormattingFeature.isEnabled decides in the same way whether a file has a formatter of its own, with LanguageFormatting.INSTANCE.forContext(file).

Not changed

  • A file whose language registers a documentation provider waits 500 ms at most, as before.
  • Documentation that a plugin provides only for any language (documentationProvider) or through a platform.backend.documentation.psiTargetProvider isn't seen. IntelliJ asks for those only when no DocumentationTargetProvider returns a target. If the reply then has no documentation, the pending target hides theirs, as it already does in a plain text file.

Test

HoverWithoutWaitingTest.testAFileWhoseLanguageRegistersNoDocumentationProviderGetsATargetWhichWaitsInTheBackground (new):

  • leaves out the documentation providers of the Properties language for the test (ExtensionTestUtil.maskExtensions);
  • asks for the targets of a .properties file while the server holds its reply, and gets a pending target;
  • gets the reply's documentation from it once the reply comes.

On main it gets no target: Expected instance of: com.redhat.devtools.lsp4ij.features.documentation.LSPPendingHoverDocumentationTarget actual: null.

The test of a file with documentation of its own now checks first that the Properties language has documentation providers.

2024.2 2025.3 IU 2026.3
The new test on main fails fails fails
The features.documentation tests and FeatureCacheOtherFileChangeTest with the change 38 pass 38 pass 38 pass

…ocumentation provider

Fixes redhat-developer#2129

Since redhat-developer#2020, LSPDocumentationTargetProvider waits 500 ms at most for the textDocument/hover reply in a file that is
not a plain text, TextMate or abstract file type file. The limit keeps a target whose reply has no documentation from
hiding the file's own documentation: IntelliJ shows that only if no provider returns a target. A file whose languages
register no documentation provider has none to hide, but got the limit too. When the server answered later, Quick
Documentation showed nothing until it was asked again.

Such a file now gets the LSPPendingHoverDocumentationTarget, as a plain text file does. LanguageDocumentation's
allForLanguage leaves out the providers registered for any language, LSP4IJ's among them.

Not changed: documentation that a plugin provides only for any language (documentationProvider) or through a
psiTargetProvider is not seen. If the reply has no documentation, the pending target hides it, as in a plain text file.

HoverWithoutWaitingTest's new test leaves out the documentation providers of the Properties language. It then gets a
pending target in a .properties file. On main it gets no target.
@lagergren lagergren added enhancement New feature or request hover labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Hover documentation now appears without waiting for the language server’s response when a file’s language has no built-in documentation provider. The server’s documentation is displayed when it arrives, without sending duplicate hover requests.

The documentation target provider now treats files whose languages have no registered documentation providers as lacking their own documentation. Tests cover pending hover behavior and late server replies for such a file.

Changes: Pending hover behavior

Layer / File(s) Summary
Provider detection and pending hover validation
src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPDocumentationTargetProvider.java, src/test/java/com/redhat/devtools/lsp4ij/features/documentation/HoverWithoutWaitingTest.java
The provider checks whether each language in a file’s view provider has a registered documentation provider. The test masks those providers, verifies that a pending hover target appears before the server reply, then checks the returned documentation and confirms one hover request. The existing test also asserts that its language has a documentation provider.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to a4a7a

Quick Documentation on files whose languages register no documentation provider should now show a late hover reply on the first request. The change is small and covered by a new test, and no concrete defect was found. The remaining uncertainty is how the IDE's provider lookup treats the plugin's own any-language providers.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a late hover reply is shown in files whose languages register no documentation provider. The changeset adds a check in LSPDocumentationTargetProvider that gives such f…
Description check Passed The description states the problem (Quick Documentation waits 500 ms at most for hover replies in files without their own documentation), the change (hasNoDocumentationOfItsOwn also counts files whose…
Linked Issues check Passed [#2129] Requires that Quick Documentation return a pending target, and show a late hover reply on the first request, for a file whose languages register no documentation provider. At head, LSPDocument…
Out of Scope Changes check Passed The change touches two files. LSPDocumentationTargetProvider.java adds the registersNoDocumentationProvider check, its javadoc, and the LanguageDocumentation import, all of which serve #2129. HoverWit…
Full details: Title check

Explanation

The title names the main change: a late hover reply is shown in files whose languages register no documentation provider. The changeset adds a check in LSPDocumentationTargetProvider that gives such files a pending hover target, and adds a test for it. The title is concise and specific.

Full details: Description check

Explanation

The description states the problem (Quick Documentation waits 500 ms at most for hover replies in files without their own documentation), the change (hasNoDocumentationOfItsOwn also counts files whose languages register no documentation provider, using LanguageDocumentation.INSTANCE.allForLanguage), the unchanged behavior, and the new test. It matches the changeset closely.

Full details: Linked Issues check

Explanation

[#2129] Requires that Quick Documentation return a pending target, and show a late hover reply on the first request, for a file whose languages register no documentation provider. At head, LSPDocumentationTargetProvider.hasNoDocumentationOfItsOwn includes registersNoDocumentationProvider(psiFile). That method returns true only when LanguageDocumentation.INSTANCE.allForLanguage(language) is empty for every language in psiFile.getViewProvider().getLanguages(). This matches the suggested check in the issue. A file in that state now takes the LSPPendingHoverDocumentationTarget path in documentationTargets, so the 500 ms limit does not apply to it. Files whose language has a documentation provider keep the 500 ms limit. The test testAFileWhoseLanguageRegistersNoDocumentationProviderGetsATargetWhichWaitsInTheBackground covers the pending target and the late reply for a .properties file, with the Properties providers masked. The test of a file with its own documentation also asserts that its language has providers. The issue's exclusions (any-language providers and psiTargetProvider) are not required by the issue. Limitation: the diff tool could not read the base blob, so the change was verified from the head file contents and the PR description. The author's test results were not re-run here.

Full details: Out of Scope Changes check

Explanation

The change touches two files. LSPDocumentationTargetProvider.java adds the registersNoDocumentationProvider check, its javadoc, and the LanguageDocumentation import, all of which serve #2129. HoverWithoutWaitingTest.java adds the new test for this case and a precondition in the existing own-documentation test. Both are supporting changes for the objective. The description's mention of LSPFormattingFeature.isEnabled describes existing code and is not a change in this PR. No unrelated behavior change was found in the reviewed content. Limitation: the base blob could not be read through the diff tool, so the full set of changed hunks was not compared against the base directly. The assessment relies on the head file contents and the PR summary.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd5e203c-c9e7-4a4b-90b4-f7836115aca0
Commits

Reviewing files that changed from the base of the PR and between 27d5297 and a4a7abd.

Files selected for processing: 2

  • src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPDocumentationTargetProvider.java
  • src/test/java/com/redhat/devtools/lsp4ij/features/documentation/HoverWithoutWaitingTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.95%. Comparing base (40c958d) to head (a4a7abd).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
.../documentation/LSPDocumentationTargetProvider.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2130      +/-   ##
==========================================
+ Coverage   50.66%   50.95%   +0.29%     
==========================================
  Files         816      820       +4     
  Lines       33910    34135     +225     
  Branches     5290     7033    +1743     
==========================================
+ Hits        17180    17393     +213     
- Misses      14066    14072       +6     
- Partials     2664     2670       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit 9fde93e into redhat-developer:main Nov 23, 2026
9 checks passed
@lagergren lagergren added this to the 0.30.2 milestone Nov 23, 2026
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 23, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 25, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 25, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 25, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 26, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 26, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 27, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 28, 2026
remaining.md and the register: LateHoverDocumentation shows a late hover on LSP4IJ 0.30.1, and the three versions
the tour rejected first. It goes with its registration and its five reviewed internal APIs once a release has
redhat-developer/lsp4ij#2130.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hover

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quick Documentation: show a late hover reply in a file whose language registers no documentation provider

1 participant