void (final CompletionParameters parameters, final CompletionResultSet result, final PairConsumer<? super PsiReference, ? super CompletionResultSet> consumer) { final int startOffset = parameters.getOffset(); final PsiReference ref = parameters.getPosition().getContainingFile().findReferenceAt(startOffset); if (ref instanceof PsiMultiReference) { for (final PsiReference reference : CompletionData.getReferences((PsiMultiReference)ref)) { if (reference instanceof PsiReferencesWrapper) { for (PsiReference r : ((PsiReferencesWrapper)reference).getReferences()) { processReference(result, startOffset, consumer, r); } } else { processReference(result, startOffset, consumer, reference); } } } else if (ref instanceof PsiDynaReference) { for (final PsiReference reference : ((PsiDynaReference<?>)ref).getReferences()) { processReference(result, startOffset, consumer, reference); } } else if (ref != null) { processReference(result, startOffset, consumer, ref); } }