List<LookupElement> (@NotNull PsiPackage aPackage) { ArrayList<LookupElement> list = new ArrayList<>(); int startOffset = StringUtil.isEmpty(aPackage.getName()) ? 0 : aPackage.getQualifiedName().length() + 1; GlobalSearchScope scope = getScope(getJavaContextFile()); for (PsiPackage subPackage : aPackage.getSubPackages(scope)) { String shortName = subPackage.getQualifiedName().substring(startOffset); if (PsiNameHelper.getInstance(subPackage.getProject()).isIdentifier(shortName)) { list.add(LookupElementBuilder.create(subPackage).withIcon(subPackage.getIcon(Iconable.ICON_FLAG_VISIBILITY))); } } List<PsiClass> classes = ContainerUtil.filter(aPackage.getClasses(scope), psiClass -> StringUtil.isNotEmpty(psiClass.getName())); Map<CustomizableReferenceProvider.CustomizationKey, Object> options = getOptions(); if (options != null) { boolean instantiatable = JavaClassReferenceProvider.INSTANTIATABLE.getBooleanValue(options); boolean concrete = JavaClassReferenceProvider.CONCRETE.getBooleanValue(options); boolean notInterface = JavaClassReferenceProvider.NOT_INTERFACE.getBooleanValue(options); boolean notEnum = JavaClassReferenceProvider.NOT_ENUM.getBooleanValue(options); ClassKind classKind = getClassKind(); for (PsiClass clazz : classes) { if (isClassAccepted(clazz, classKind, instantiatable, concrete, notInterface, notEnum)) { list.add(JavaClassNameCompletionContributor.createClassLookupItem(clazz, false)); } } } else { for (PsiClass clazz : classes) { list.add(JavaClassNameCompletionContributor.createClassLookupItem(clazz, false)); } } return list; }