From 29278aa5544afd961a2fbc01e72bf5ccdea8717f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kroi=C3=9F=2C=20Florian?= Date: Wed, 28 Jan 2026 13:12:14 +0100 Subject: [PATCH] fix: Cancel computation when Thread has been interrupted --- .../operations/completion/LSContentAssistProcessor.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java index 21f4c7764..0ceda9b93 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java @@ -181,10 +181,11 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int this.errorMessage = createErrorMessage(offset, e); return createErrorProposal(offset, e); } catch (InterruptedException e) { - LanguageServerPlugin.logError(e); - this.errorMessage = createErrorMessage(offset, e); - Thread.currentThread().interrupt(); - return createErrorProposal(offset, e); + // The current thread has been interrupted by the AsyncCompletionProposalPopup#cancelFutures to + // indicate that we can stop computing results, because they won't be used anymore. + // Forward cancellation to LS and return dummy result + completionCancellationSupport.cancel(); + return NO_COMPLETION_PROPOSALS; } catch (CancellationException e) { // return the elements already collected, if any }