You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Call Hierarchy shows no callers when a write action comes while it waits for callHierarchy/incomingCalls #2278
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.
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
Link UP88 to redhat-developer/lsp4ij#2278, filed for it, and say LSP4…
Link UP88 to redhat-developer/lsp4ij#2278, filed for it, and say LSP4…
fix: the Call Hierarchy computes a method's callers and callees again…
Link UP88 to redhat-developer/lsp4ij#2278, filed for it, and say LSP4…
Link UP88 to redhat-developer/lsp4ij#2278, filed for it, and say LSP4…