LookupElementBuilder (PsiElement element, LookupElementBuilder builder, PsiSubstitutor substitutor) { if (element instanceof PsiMethod) { PsiClass aClass = ((PsiMethod)element).getContainingClass(); if (aClass != null && aClass.isAnnotationType()) { return builder; } builder = builder.withTailText(PsiFormatUtil.formatMethod((PsiMethod)element, substitutor, PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE)); } else if (element instanceof PsiClass psiClass) { String tailText = getPackageText((PsiClass)element); if ((substitutor == null || substitutor.getSubstitutionMap().isEmpty()) && psiClass.getTypeParameters().length > 0) { tailText = "<" + StringUtil.join(psiClass.getTypeParameters(), psiTypeParameter -> psiTypeParameter.getName(), "," + (showSpaceAfterComma(psiClass) ? " " : "")) + ">" + tailText; } builder = builder.withTailText(tailText, true); } return builder; }