void (Set<LookupElement> set, PsiElement element, PrefixMatcher matcher) { if (element instanceof PsiMethod method && method.isConstructor()) { PsiClass containingClass = method.getContainingClass(); if (containingClass != null) { String name = containingClass.getName(); if (StringUtil.isNotEmpty(name)) { addLookupItems(set, null, matcher, element.getProject(), name); } } return; } PsiClass ourClassParent = PsiTreeUtil.getParentOfType(element, PsiClass.class); if (ourClassParent == null) return; if (ourClassParent.isAnnotationType() && matcher.prefixMatches(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME)) { set.add(LookupElementBuilder.create(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME) .withIcon(IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Method)) .withTailText("()") .withInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS)); } if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.STATIC) && ourClassParent.equals(PsiUtil.resolveClassInClassTypeOnly(((PsiField)element).getType()))) { set.add(LookupElementBuilder.create("getInstance") .withIcon(IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Method)) .withTailText("()") .withInsertHandler(ParenthesesInsertHandler.WITH_PARAMETERS)); } addLookupItems(set, null, matcher, element.getProject(), getUnresolvedReferences(ourClassParent, true, matcher)); addLookupItems(set, null, matcher, element.getProject(), getPropertiesHandlersNames( ourClassParent, ((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC), PsiUtil.getTypeByPsiElement(element), element)); }