Skip to content

Since 0.20.2, a failed request or a language server which can't start raises an IDE error #1830

Closed

Description

@lagergren

Problem

Since 0.20.2, a failed LSP request, or a language server which fails to start, is reported as an IDE error ("IDE error occurred") from the editor's highlighting passes. For a server whose command can't run, LSP4IJ shows its own "Cannot start server" notification, and IntelliJ then also shows an IDE error:

java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.redhat.devtools.lsp4ij.server.CannotStartProcessException: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "-classpath": error=2, No such file or directory
	at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:136)
	at com.redhat.devtools.lsp4ij.internal.CompletableFutures.awaitWithCheckCanceled(CompletableFutures.java:132)
	at com.redhat.devtools.lsp4ij.features.color.LSPColorProvider.doCollect(LSPColorProvider.java:96)
	at com.redhat.devtools.lsp4ij.features.AbstractLSPInlayHintsProvider$1.collect(AbstractLSPInlayHintsProvider.java:74)

Cause

15aa49ae ("perf: Use ProgressIndicatorUtils.awaitWithCheckCanceled", in 0.20.2) replaced CompletableFutures.waitUntilDone(...), which threw a checked ExecutionException that the callers caught, with CompletableFutures.awaitWithCheckCanceled(...). That calls IntelliJ's ProgressIndicatorUtils.awaitWithCheckCanceled, which rethrows the failure of the future in a RuntimeException. The callers' catch blocks for the failure were removed. About 40 callers now catch only cancellations and then check isDoneNormally(future) to skip a failed future, but the failure is thrown before that check: the color provider, folding, inlay hints, code lens, semantic tokens, hover, highlight, signature help, Go to Declaration and others. CancellationSupport's own wait, used by Go to Symbol and Go to Class, throws the failure too.

#784 was the same regression for completionItem/resolve. #1600 reports a CannotStartProcessException on the EDT, from another path.

Expected

A failed request, or a language server which can't start, is skipped by the features which wait for it, without an IDE error. The server's failure is already reported by LSP4IJ, and an LSP error response by CancellationSupport, as the server's Error reporting setting says.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions