use of ool.intellij.plugin.file.index.nacro.js.JsMacroNameIndexedElement in project oxy-template-support-plugin by mutant-industries.
the class OxyTemplateIndexUtil method getJsSymbols.
@NotNull
public static HashMultimap<String, JSElement> getJsSymbols(@NotNull Project project, boolean macros, boolean namespaces, @Nullable Collection<VirtualFile> restrictFiles) {
final GlobalSearchScope allScope = ProjectScope.getProjectScope(project);
FileBasedIndex index = FileBasedIndex.getInstance();
HashMultimap<String, JSElement> result = HashMultimap.create();
for (String key : index.getAllKeys(JsMacroNameIndex.INDEX_ID, project)) {
MacroCollector<JSElement, JsMacroNameIndexedElement> collector = new JsMacroCollector(project);
Collection<VirtualFile> virtualFiles = restrictFiles != null ? restrictFiles : index.getContainingFiles(JsMacroNameIndex.INDEX_ID, key, allScope);
index.getValues(JsMacroNameIndex.INDEX_ID, key, allScope).stream().filter(macroName -> macroName.isMacro() && macros || !macroName.isMacro() && namespaces).forEach(macroName -> virtualFiles.forEach(file -> index.processValues(JsMacroNameIndex.INDEX_ID, key, file, collector, allScope)));
collector.getResult().stream().forEach(element -> result.put(key, element));
}
return result;
}
use of ool.intellij.plugin.file.index.nacro.js.JsMacroNameIndexedElement in project oxy-template-support-plugin by mutant-industries.
the class OxyTemplateIndexUtil method getJsMacroNameReferences.
@NotNull
public static List<JSElement> getJsMacroNameReferences(@NotNull String macroName, @NotNull VirtualFile file, @NotNull final Project project) {
final GlobalSearchScope allScope = ProjectScope.getProjectScope(project);
FileBasedIndex index = FileBasedIndex.getInstance();
MacroCollector<JSElement, JsMacroNameIndexedElement> processor = new JsMacroCollector(project);
index.processValues(JsMacroNameIndex.INDEX_ID, macroName, file, processor, allScope);
// size <= 1
return processor.getResult();
}
Aggregations