Skip to content

Call Hierarchy shows no callers when a write action comes while it waits for callHierarchy/incomingCalls #2278

Done

Description

@lagergren

Summary

The Call Hierarchy view can show a method with no callers, or no callees, when IntelliJ runs a write action while LSP4IJ waits for callHierarchy/incomingCalls (or outgoingCalls, or textDocument/prepareCallHierarchy). The empty node stays that way until Refresh. Any write action during the wait does it: typing, a save, a VFS refresh, or IntelliJ's own cloud registry update.

Seen with 0.30.1, and the code is unchanged on main (9688c9d3).

Cause

The three call hierarchy tree structures catch the ProcessCanceledException from awaitWithCheckCanceled, cancel the LSP request, and go on to fillChildren with what they have, which is nothing:

IntelliJ's hierarchy tree computes a node's children in a cancellable read action, which a write action cancels. The platform computes them again only if the computation ends with the ProcessCanceledException. Here it ends normally with no children, so the empty result is taken and HierarchyTreeStructure.getChildElements caches it.

The type hierarchy doesn't have the problem: LSPTypeHierarchyTreeStructureBase rethrows the ProcessCanceledException.

How it shows

In the language server's trace, callHierarchy/incomingCalls is followed within a few milliseconds by its $/cancelRequest, and no further request comes. In our case the IDE log had IntelliJ's RegistryUpdater applying an update in a write action in the same 5 ms.

To reproduce deterministically, have the language server hold its incomingCalls answer, open the Call Hierarchy for a method, and run a write action (for example WriteAction.runAndWait {}) while the request is pending. The callers never appear. If the language server answers before the write action, they do.

Fix

In each of the three catch (ProcessCanceledException ex) blocks, keep the cancel() and then rethrow the exception, as the type hierarchy does. IntelliJ then computes the node's children again and sends a new request.

As a workaround, our plugin registers its own CallHierarchyProvider for its language, whose tree structures call ProgressManager.checkCanceled() after LSP4IJ builds a node's children.

Activity

  1. added a commit that references this issue on Nov 26, 2026
  2. added
    bug
    on Nov 26, 2026
  3. added this to the 0.30.2 milestone on Nov 26, 2026
  4. added a commit that references this issue on Nov 26, 2026
  5. added a commit that references this issue on Nov 26, 2026
    b1b270a
  6. added 2 commits that reference this issue on Nov 27, 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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions