Set<LookupElement> (CompletionParameters _parameters, GrReferenceElement<?> qualifier, JavaCompletionSession session) { String referenceName = qualifier.getReferenceName(); if (referenceName == null) { return Collections.emptySet(); } PsiElement nameElement = qualifier.getReferenceNameElement(); if (nameElement == null) { return Collections.emptySet(); } CompletionParameters parameters = _parameters.withPosition(nameElement, qualifier.getTextRange().getEndOffset()); final PrefixMatcher qMatcher = new CamelHumpMatcher(referenceName); final Set<LookupElement> variants = new LinkedHashSet<>(); GrMainCompletionProvider.completeReference(parameters, qualifier, session, qMatcher, null, element -> { if (qMatcher.prefixMatches(element)) { variants.add(element); } }); for (PsiClass aClass : PsiShortNamesCache.getInstance(qualifier.getProject()).getClassesByName(referenceName, qualifier.getResolveScope())) { variants.add(GroovyCompletionUtil.createClassLookupItem(aClass)); } if (variants.isEmpty()) { GrMainCompletionProvider.addAllClasses(parameters, element -> { if (qMatcher.prefixMatches(element)) { variants.add(element); } }, session, qMatcher); } return variants; }