Skip to content

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

Closed

Description

@lagergren

What happens

Since #2020, Quick Documentation (Ctrl+Q, F1) waits at most 500 ms for the textDocument/hover reply in a file that isn't a plain text, TextMate or abstract file type file. A later reply shows only the next time at the same offset.

The limit is there so that a target whose reply has no documentation doesn't hide the file's own documentation. IntelliJ shows that only if no DocumentationTargetProvider returns a target: documentationTargets in com.intellij.lang.documentation.impl falls back to psiDocumentationTargets when the list is empty.

A plugin can define a language and a file type for its parser, highlighting and structure view, and leave documentation to its language server. Its files then have no documentation of their own to hide, but they still get the 500 ms limit. When the server is slow, Quick Documentation shows nothing, and the user has to ask again. A typical slow reply is the first hover after a restart, which waits for the server to analyze the file.

Steps

  1. A plugin defines a language with a file type and a parser definition, and registers no lang.documentationProvider for it.
  2. A language server for its files answers textDocument/hover after more than 500 ms.
  3. Press Ctrl+Q on a word in one of its files.

Nothing shows. A second Ctrl+Q shows the reply.

Expected

The same as in a plain text file: the popup opens and shows the reply when it comes (LSPPendingHoverDocumentationTarget).

Suggested change

In LSPDocumentationTargetProvider.hasNoDocumentationOfItsOwn, also count a file whose languages register no documentation provider: LanguageDocumentation.INSTANCE.allForLanguage(language) is empty for each language of the file's view provider.

  • allForLanguage leaves out the providers registered for any language, such as LSP4IJ's LSPDocumentLinkDocumentationProvider and LSPSemanticTokenDocumentationProvider.
  • LSPFormattingFeature.isEnabled decides in the same way whether a file has a formatter of its own: it checks LanguageFormatting.INSTANCE.forContext(file).

The check can't see two kinds of provider:

  • a provider registered for any language (documentationProvider);
  • a platform.backend.documentation.psiTargetProvider.

If the reply then has no documentation, the pending target hides theirs, as it already does in a plain text file. If that is a concern, a hook on LSPHoverFeature could let a client decide instead, as LSPFormattingFeature.isExistingFormatterOverrideable does for formatting.

Related

#2020, #2016

Activity

  1. added
    enhancement
    on Nov 23, 2026
  2. added 11 commits that reference this issue on Nov 23, 2026
    9fde93e
    354ae24
    89870a4
    92e0f66
    b5ba3a2
    b70b46c
    43dfde0
    09ed4b1
    0897498
    0b682ed
    1a24b45
  3. 4 remaining items

  4. added this to the 0.30.2 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhover

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions