Skip to content

Commit c778c29

Browse files
committed
fix: Cancel computation when Thread has been interrupted
1 parent d8b551a commit c778c29

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
172172
this.errorMessage = createErrorMessage(offset, e);
173173
return createErrorProposal(offset, e);
174174
} catch (InterruptedException e) {
175-
LanguageServerPlugin.logError(e);
176-
this.errorMessage = createErrorMessage(offset, e);
177-
Thread.currentThread().interrupt();
178-
return createErrorProposal(offset, e);
175+
// The current thread has been interrupted by the AsyncCompletionProposalPopup#cancelFutures to
176+
// indicate that we can stop computing results, because they won't be used anymore.
177+
// Forward cancellation to LS and return dummy result
178+
completionCancellationSupport.cancel();
179+
return NO_COMPLETION_PROPOSALS;
179180
} catch (CancellationException e) {
180181
// return the elements already collected, if any
181182
}

0 commit comments

Comments
 (0)