boolean (final CompletionParameters parameters, final CompletionResultSet result) { final CompletionData completionData = getCompletionData(parameters); if (completionData == null) { return false; } final Ref<Boolean> hasVariants = Ref.create(false); processReferences(parameters, result, (reference, resultSet) -> { final Set<LookupElement> lookupSet = new LinkedHashSet<>(); completionData.completeReference(reference, lookupSet, parameters.getPosition(), parameters.getOriginalFile()); for (final LookupElement item : lookupSet) { if (resultSet.getPrefixMatcher().prefixMatches(item)) { if (!item.isValid()) { LOG.error(completionData + " has returned an invalid lookup element " + item + " of " + item.getClass() + " in " + parameters.getOriginalFile() + " of " + parameters.getOriginalFile().getClass() + "; reference=" + reference + " of " + reference.getClass()); } hasVariants.set(true); resultSet.addElement(item); } } }); return hasVariants.get().booleanValue(); }