-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignoring failures when checking for hyperlinks #1186
base: main
Are you sure you want to change the base?
Conversation
Adding LanguageServers.addAllSuccessful as an alternative to LanguageServers.addAll so that exceptions from one of the requests being combined can be ignored. Then using this new method in OpenDeclarationHyperlinkDetector when combining the results from definitions, declarations, typeDefinitions, and implementions because some LSPs return errors instead of empty lists for some of these calls. Instead, we combine only the successful results when building the list of hyperlinks, ignoring the errors. This should resolve eclipse-lsp4e#1169
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I like the idea but I think we should improve a little bit the changes.
@@ -30,10 +30,16 @@ | |||
<arguments> | |||
</arguments> | |||
</buildCommand> | |||
<buildCommand> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks unrelated to the ticket you are resolving. Could you move the change to a new PR so that it can be looked at independently?
@@ -12,6 +12,16 @@ | |||
*******************************************************************************/ | |||
package org.eclipse.lsp4e; | |||
|
|||
import org.eclipse.core.resources.IProject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like organize imports is configured different than by default. Could you change it so that the PR does not change the order of the import in all the modified files?
@@ -410,6 +410,30 @@ public static <T> CompletableFuture<List<T>> addAll(CompletableFuture<List<T>> a | |||
return res; | |||
} | |||
|
|||
/** | |||
* Combines two async lists of results into a single list by adding all the elements of the second list to the first one, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Combines two async lists of results into a single list by adding all the elements of the second list to the first one, | |
* Combines async lists of results into a single list by adding all the elements of each lists to a new list |
@@ -410,6 +410,30 @@ public static <T> CompletableFuture<List<T>> addAll(CompletableFuture<List<T>> a | |||
return res; | |||
} | |||
|
|||
/** | |||
* Combines two async lists of results into a single list by adding all the elements of the second list to the first one, | |||
* ignoring abnormal results and only including succeses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ignoring abnormal results and only including succeses. | |
* ignoring any CompletableFuture that completed exceptionally. |
.thenApply( v -> { | ||
List<T> results = new ArrayList<>(futures.length); | ||
for(CompletableFuture<List<T>> f : futures) { | ||
if (!f.isCompletedExceptionally()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of just ignoring exceptions, I think we should log them using LanguageServerPlugin.logError
Adding LanguageServers.addAllSuccessful as an alternative to LanguageServers.addAll so that exceptions from one of the requests being combined can be ignored. Then using this new method in OpenDeclarationHyperlinkDetector when combining the results from definitions, declarations, typeDefinitions, and implementions because some LSPs return errors instead of empty lists for some of these calls. Instead, we combine only the successful results when building the list of hyperlinks, ignoring the errors.
This should resolve #1169