Repository navigation
Description
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.getWorkspaceEditawaits a server'sworkspace/will*reply. AProcessCanceledExceptionmeans there that the enclosing progress was cancelled, so it cancels the request and rethrows, andcollectWillEditsstops without asking the other servers. Any other exception, as theCancellationExceptionof a cancelled request was, returns no edit for that server and goes on:
lsp4ij/src/main/java/com/redhat/devtools/lsp4ij/features/files/AbstractLSPFileListener.java
Lines 484 to 503 in b2eeaf7
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.testReturnsNullOnCancellationfails there with theProcessCanceledException.- LSP4IJ's own
CompletableFutures.awaitWithCheckCanceled, used for hover, folding ranges, inlay hints, usages and semantic tokens, throws aProcessCanceledExceptiontoo then:
lsp4ij/src/main/java/com/redhat/devtools/lsp4ij/internal/CompletableFutures.java
Line 144 in b2eeaf7
public static void awaitWithCheckCanceled(@Nullable Future<?> future) {
AwaitWithCheckCanceledTest.testACancelledFutureThrowsItsCancellationfails on 2026.3:expected:<class java.util.concurrent.CancellationException> but was:<class com.intellij.openapi.progress.ProcessCanceledException>. AProcessCanceledExceptionis aCancellationExceptionsince 2024.2, so the callers that catchCancellationExceptionstill get it, but a caller that catchesProcessCanceledExceptionfirst takes it for the operation's cancellation, asgetWorkspaceEditdoes.
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix: tell a cancelled request from a cancelled operation on Java 25 (r…