use of com.intellij.lang.javascript.psi.JSQualifiedNameImpl in project intellij-plugins by JetBrains.
the class AngularIndexUtil method multiResolveAngularNamedDefinitionIndex.
public static ResolveResult[] multiResolveAngularNamedDefinitionIndex(@NotNull final Project project, @NotNull final ID<String, AngularNamedItemDefinition> INDEX, @NotNull final String id, @NotNull final Condition<VirtualFile> filter, boolean dirtyResolve) {
final FileBasedIndex instance = FileBasedIndex.getInstance();
Collection<VirtualFile> files = instance.getContainingFiles(INDEX, id, GlobalSearchScope.allScope(project));
if (files.isEmpty())
return ResolveResult.EMPTY_ARRAY;
final List<VirtualFile> filtered = ContainerUtil.filter(files, filter);
if (filtered.isEmpty()) {
if (!dirtyResolve)
return ResolveResult.EMPTY_ARRAY;
} else {
files = filtered;
}
final List<JSImplicitElement> elements = new ArrayList<>();
for (VirtualFile file : files) {
final List<AngularNamedItemDefinition> values = instance.getValues(INDEX, id, GlobalSearchScope.fileScope(project, file));
for (AngularNamedItemDefinition value : values) {
JSQualifiedNameImpl qName = JSQualifiedNameImpl.fromQualifiedName(id);
JSImplicitElementImpl.Builder elementBuilder = new JSImplicitElementImpl.Builder(qName, null);
final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
if (psiFile != null) {
elements.add(new JSOffsetBasedImplicitElement(elementBuilder, (int) value.getStartOffset(), psiFile));
}
}
}
final List<ResolveResult> list = ContainerUtil.map(elements, JS_IMPLICIT_TO_RESOLVE_RESULT);
return list.toArray(new ResolveResult[list.size()]);
}
Aggregations