[java-completion] JavaGenerateMemberCompletionContributor: avoid cleanup of invalid elements

GitOrigin-RevId: b967fc372da6fbbb2dab9cd5cc249b074f51cf43
This commit is contained in:
Tagir Valeev
2024-04-23 09:43:56 +00:00
committed by intellij-monorepo-bot
parent 9b95ac26a6
commit c2f7be4f76
@@ -263,7 +263,8 @@ public final class JavaGenerateMemberCompletionContributor {
newInfos.get(0).positionCaret(context.getEditor(), true);
ApplicationManager.getApplication().invokeLater(
() -> GlobalInspectionContextBase.cleanupElements(context.getProject(), null, elements.toArray(PsiElement.EMPTY_ARRAY)));
() -> GlobalInspectionContextBase.cleanupElements(
context.getProject(), null, elements.stream().filter(e -> e.isValid()).toArray(PsiElement[]::new)));
}
}