Skip to content

Quick Documentation makes the UI thread wait for textDocument/hover #2016

Closed

Description

@lagergren

Two freezes of LSP4IJ 0.21.0 in #2014, Report 2109947243716149248 (23 s) and Report 2109884672023724032 (18 s), both in IntelliJ IDEA 262.10968.63 at startup with probable cause EDT_RUN_BLOCKING, have the UI thread waiting for textDocument/hover.

A key press runs an action update on the EDT (IdeKeyEventDispatcher → Utils.runUpdateSessionForInputEvent → runBlockingForActionExpand), which blocks until a read action on a background thread returns. That read action waits for the hover reply:

ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:374)
LSPDocumentationTargetProvider.documentationTargets(LSPDocumentationTargetProvider.java:76)
TargetsKt.documentationTargets(targets.kt:17)

So the UI waits for the language server for as long as it takes to answer textDocument/hover.

In 0.30.0: unchanged. documentationTargets still sends textDocument/hover and waits for it at line 76; 2a5d042 only made the wait null-safe. I haven't reproduced the freeze on 0.30.0 yet.

Possible fix: don't wait in documentationTargets, which the platform also calls from action updates. Return a target for the offset at once, and wait for the hover when the target computes its documentation, which the platform can do asynchronously (for example with DocumentationResult.asyncDocumentation).

Activity

  1. added
    bug
    on Nov 18, 2026
  2. lagergren commented on Nov 18, 2026

    @lagergren
    CollaboratorAuthor

    Reproduced on main (0bdec3f, 0.30.0) in IntelliJ IDEA 2026.3 (IU-263.7307.200). With a language server that answers textDocument/hover after 15 s, Quick Documentation (F1) froze the UI thread for 15.1 s, and IntelliJ recorded a freeze dump with the same stack as the reports, now through 0.30.0's CompletableFutures.awaitWithCheckCanceled:

    ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:379)
    CompletableFutures.awaitWithCheckCanceled(CompletableFutures.java:149)
    LSPDocumentationTargetProvider.documentationTargets(LSPDocumentationTargetProvider.java:76)
    ...
    Utils$runUpdateSessionForInputEvent$1$1$result$1$1$1.invoke(Utils.kt:1200)
    
  3. added a commit that references this issue on Nov 18, 2026
    9439167
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

    bughoverperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions