private static Collection<DartLookupElement> addCompletionVariants(@NotNull DartReference reference,
Set<DartComponentName> suggestedVariants) {
DartClass dartClass = null;
// if do not contain references
if (DartResolveUtil.aloneOrFirstInChain(reference)) {
DartResolveUtil.treeWalkUpAndTopLevelDeclarations(reference, new ComponentNameScopeProcessor(suggestedVariants));
dartClass = PsiTreeUtil.getParentOfType(reference, DartClass.class);
}
final DartReference leftReference = DartResolveUtil.getLeftReference(reference);
if (leftReference != null) {
final DartClassResolveResult classResolveResult = leftReference.resolveDartClass();
dartClass = classResolveResult.getDartClass();
// prefix
if (PsiTreeUtil.getParentOfType(leftReference.resolve(), DartImportStatement.class, DartExportStatement.class) != null) {
final VirtualFile virtualFile =
DartResolveUtil.getImportedFileByImportPrefix(reference.getContainingFile(), leftReference.getText());
DartResolveUtil.processTopLevelDeclarations(reference, new ComponentNameScopeProcessor(suggestedVariants), virtualFile, null);
}
}
if (dartClass != null) {
final boolean needFilterPrivateMembers = !DartResolveUtil.sameLibrary(reference, dartClass);