Skip to content

On IntelliJ 2026.3, a request cancelled while it's awaited is taken for a cancelled operation #1907

Closed

Description

@lagergren

On IntelliJ 2026.3, ProgressIndicatorUtils.awaitWithCheckCanceled(future) throws a ProcessCanceledException for a future that was cancelled, where 2025.3 and earlier throw the future's CancellationException. The change comes from Java, not from the platform: since Java 25, the get() of a cancelled CompletableFuture throws a CancellationException caused by the future's own (on Java 21 it has no cause), and the platform reports a CancellationException with that cause as a ProcessCanceledException. 2026.3 runs on Java 25. LSP4IJ tells the two apart, so a cancelled request is now handled as if the whole operation had been cancelled. The released plugin gets it too, on any IDE that runs on Java 25.

How it shows

  • AbstractLSPFileListener.getWorkspaceEdit awaits a server's workspace/will* reply. A ProcessCanceledException means there that the enclosing progress was cancelled, so it cancels the request and rethrows, and collectWillEdits stops without asking the other servers. Any other exception, as the CancellationException of a cancelled request was, returns no edit for that server and goes on:
    try {
    var f = future;
    WorkspaceEdit result = ProgressIndicatorUtils.withTimeout(remainingMs,
    () -> ProgressIndicatorUtils.awaitWithCheckCanceled(f));
    if (result == null) {
    // withTimeout returns null when its internal timeout fires;
    // cancel the LSP future so the server receives $/cancelRequest
    future.cancel(true);
    }
    return result;
    } catch (ProcessCanceledException e) {
    // The enclosing progress indicator was cancelled (e.g. the VFS
    // operation is being aborted). Cancel the LSP future and rethrow
    // so collectWillEdits stops immediately instead of trying the
    // remaining workspace/will* requests.
    future.cancel(true);
    throw e;
    } catch (Exception e) {
    return null;
    }

    On 2026.3, a request cancelled while it's awaited takes the first branch, and the file operation loses the edits of the servers after it. GetWorkspaceEditTest.testReturnsNullOnCancellation fails there with the ProcessCanceledException.
  • LSP4IJ's own CompletableFutures.awaitWithCheckCanceled, used for hover, folding ranges, inlay hints, usages and semantic tokens, throws a ProcessCanceledException too then:
    public static void awaitWithCheckCanceled(@Nullable Future<?> future) {

    AwaitWithCheckCanceledTest.testACancelledFutureThrowsItsCancellation fails on 2026.3: expected:<class java.util.concurrent.CancellationException> but was:<class com.intellij.openapi.progress.ProcessCanceledException>. A ProcessCanceledException is a CancellationException since 2024.2, so the callers that catch CancellationException still get it, but a caller that catches ProcessCanceledException first takes it for the operation's cancellation, as getWorkspaceEdit does.

Both tests pass on 2024.2, which CI builds against, and on 2025.3. They were run on 2026.3 with the build changes of #1908.

Possible direction

Tell the request's own cancellation from the progress's by the future: when future.isCancelled(), a ProcessCanceledException from awaiting it is the request's cancellation, and getWorkspaceEdit returns no edit for it, as before.

Activity

  1. added
    bug
    on Nov 9, 2026
  2. moved this to In Progress in Java Toolingon Nov 9, 2026
  3. added this to the 0.30.0 milestone on Nov 9, 2026
  4. moved this from In Progress to Done in Java Toolingon Nov 9, 2026
  5. added a commit that references this issue on Nov 10, 2026
    909ed90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions