From 9d5547b78d2d7aae30b2b2d173c5a4226a0ea4df Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Wed, 28 Jun 2023 11:30:34 +0200 Subject: [PATCH] fix: don't log canceled completion requests' exceptions Signed-off-by: Fred Bricon --- .../operations/completion/LSContentAssistProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/completion/LSContentAssistProcessor.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/completion/LSContentAssistProcessor.java index 4d550ad45..61e44bf11 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/completion/LSContentAssistProcessor.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/completion/LSContentAssistProcessor.java @@ -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; @@ -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)); @@ -88,7 +91,7 @@ private Collection toProposals(Project project, Editor CompletionList> completion, LanguageServer languageServer) { if (completion != null) { List 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())).