Skip to content

Commit

Permalink
fix: don't log canceled completion requests' exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Jun 28, 2023
1 parent 6ec29f8 commit 9d5547b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
Expand Down Expand Up @@ -76,6 +77,8 @@ public void fillCompletionVariants(@NotNull CompletionParameters parameters, @No
}

}
} catch (ProcessCanceledException cancellation){
throw cancellation;
} catch (RuntimeException | InterruptedException e) {
LOGGER.warn(e.getLocalizedMessage(), e);
result.addElement(createErrorProposal(offset, e));
Expand All @@ -88,7 +91,7 @@ private Collection<? extends LookupElement> toProposals(Project project, Editor
CompletionList> completion, LanguageServer languageServer) {
if (completion != null) {
List<CompletionItem> items = completion.isLeft()?completion.getLeft():completion.getRight().getItems();
boolean isIncomplete = completion.isLeft()?false:completion.getRight().isIncomplete();
boolean isIncomplete = !completion.isLeft() && completion.getRight().isIncomplete();
return items.stream().map(item -> createLookupItem(project, editor, offset, item, isIncomplete, languageServer)).
filter(item -> item.validate(document, offset, null)).
map(item -> PrioritizedLookupElement.withGrouping(item, item.getItem().getKind().getValue())).
Expand Down

0 comments on commit 9d5547b

Please sign in to comment.