LookupElement (@NotNull PsiClass qualifierClass, @NotNull ChainCompletionContext context) { PsiNamedElement element = context.getQualifiers(qualifierClass).findFirst().orElse(null); if (element == null) { return new ChainCompletionNewVariableLookupElement(qualifierClass, context); } else { if (element instanceof PsiVariable) { return new VariableLookupItem((PsiVariable)element); } else if (element instanceof PsiMethod) { return createMethodLookupElement((PsiMethod)element); } throw new AssertionError("unexpected element: " + element); } }