Skip to content

Commit

Permalink
Revert "Completion "hangs" with no response #743"
Browse files Browse the repository at this point in the history
This reverts commit a8cd25e.
  • Loading branch information
mickaelistria committed Aug 16, 2023
1 parent a8cd25e commit 5599909
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
public class LSContentAssistProcessor implements IContentAssistProcessor {

private static final long TRIGGERS_TIMEOUT = 50;
private static final long GET_TIMEOUT = 1000;
private static final long CONTEXT_INFORMATION_TIMEOUT = 1000;
private IDocument currentDocument;
private String errorMessage;
Expand Down Expand Up @@ -112,7 +111,7 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
.withFilter(capabilities -> capabilities.getCompletionProvider() != null)
.collectAll((w, ls) -> ls.getTextDocumentService().completion(param)
.thenAccept(completion -> proposals.addAll(toProposals(document, offset, completion, w))));
this.completionLanguageServersFuture.get(GET_TIMEOUT, TimeUnit.MILLISECONDS);
this.completionLanguageServersFuture.get();
} catch (ResponseErrorException | ExecutionException e) {
if (!CancellationUtil.isRequestCancelledException(e)) { // do not report error if the server has cancelled the request
LanguageServerPlugin.logError(e);
Expand All @@ -124,8 +123,6 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
this.errorMessage = createErrorMessage(offset, e);
Thread.currentThread().interrupt();
return createErrorProposal(offset, e);
} catch (TimeoutException e) {
LanguageServerPlugin.logWarning("Could not get completions due to timeout after " + GET_TIMEOUT + " milliseconds", e); //$NON-NLS-1$ //$NON-NLS-2$
}

final var completeProposals = new LSCompletionProposal[proposals.size()];
Expand Down Expand Up @@ -258,7 +255,7 @@ public IContextInformation[] computeContextInformation(ITextViewer viewer, int o
Thread.currentThread().interrupt();
return new IContextInformation[] { /* TODO? show error in context information */ };
} catch (TimeoutException e) {
LanguageServerPlugin.logWarning("Could not compute context information due to timeout after " + CONTEXT_INFORMATION_TIMEOUT + " milliseconds", e); //$NON-NLS-1$//$NON-NLS-2$
LanguageServerPlugin.logWarning("Could not compute context information due to timeout after " + CONTEXT_INFORMATION_TIMEOUT + " milliseconds", e); //$NON-NLS-1$//$NON-NLS-2$
return new IContextInformation[] { /* TODO? show error in context information */ };
}
return contextInformations.toArray(new IContextInformation[0]);
Expand Down

0 comments on commit 5599909

Please sign in to comment.