Skip to content

Commit

Permalink
Handle errors coming from LS responses for completion items (#1039)
Browse files Browse the repository at this point in the history
Handle errors coming from LS responses for completion items
  • Loading branch information
BoykoAlex authored Jul 19, 2024
1 parent 0e16bf1 commit 75d300b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true
Bundle-Version: 0.18.11.qualifier
Bundle-Version: 0.18.12.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.equinox.common;bundle-version="3.8.0",
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<artifactId>org.eclipse.lsp4e</artifactId>
<packaging>eclipse-plugin</packaging>
<version>0.18.11-SNAPSHOT</version>
<version>0.18.12-SNAPSHOT</version>

<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,19 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
if (isIncomplete) {
anyIncomplete.set(true);
}
}).exceptionally(t -> {
if (!CancellationUtil.isRequestCancelledException(t)) {
LanguageServerPlugin.logError("'%s' LS failed to compute completion items.".formatted(w.serverDefinition.label), t); //$NON-NLS-1$
}
return null;
}));
cancellationSupport.execute(completionLanguageServersFuture);
this.cancellationSupport = cancellationSupport;

// Wait for the result of all LSP requests 'textDocument/completions', this future will be canceled with the next completion
this.completionLanguageServersFuture.get();
} catch (ResponseErrorException | ExecutionException | CancellationException e) {
if (!CancellationUtil.isRequestCancelledException(e)) { // do not report error if the server has cancelled the request
LanguageServerPlugin.logError(e);
}
} catch (ExecutionException e) {
// Ideally exceptions from each LS are handled above and we shouldn't be getting into this block
this.errorMessage = createErrorMessage(offset, e);
return createErrorProposal(offset, e);
} catch (InterruptedException e) {
Expand Down

0 comments on commit 75d300b

Please sign in to comment.