Skip to content

Commit 7abcc39

Browse files
FlorianKroissrubenporras
authored andcommitted
fix: Cancel computation when Thread has been interrupted
1 parent 1dbc271 commit 7abcc39

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
@@ -181,10 +181,11 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
181181
this.errorMessage = createErrorMessage(offset, e);
182182
return createErrorProposal(offset, e);
183183
} catch (InterruptedException e) {
184-
LanguageServerPlugin.logError(e);
185-
this.errorMessage = createErrorMessage(offset, e);
186-
Thread.currentThread().interrupt();
187-
return createErrorProposal(offset, e);
184+
// The current thread has been interrupted by the AsyncCompletionProposalPopup#cancelFutures to
185+
// indicate that we can stop computing results, because they won't be used anymore.
186+
// Forward cancellation to LS and return dummy result
187+
completionCancellationSupport.cancel();
188+
return NO_COMPLETION_PROPOSALS;
188189
} catch (CancellationException e) {
189190
// return the elements already collected, if any
190191
}

0 commit comments

Comments
 (0)