diff --git a/src/com/reason/bs/BucklescriptImpl.java b/src/com/reason/bs/BucklescriptImpl.java index 47d088783..16e3da94f 100644 --- a/src/com/reason/bs/BucklescriptImpl.java +++ b/src/com/reason/bs/BucklescriptImpl.java @@ -107,7 +107,7 @@ public boolean isDependency(@Nullable VirtualFile file) { return false; } - VirtualFile bsConfigFile = Platform.findBsconfig(m_project, file); + VirtualFile bsConfigFile = Platform.findAncestorBsconfig(m_project, file); return bsConfigFile == null || getOrRefreshBsConfig(bsConfigFile).accept(file.getPath()); } diff --git a/src/com/reason/ide/insight/provider/JsxNameCompletionProvider.java b/src/com/reason/ide/insight/provider/JsxNameCompletionProvider.java index 5253881ea..2908039e1 100644 --- a/src/com/reason/ide/insight/provider/JsxNameCompletionProvider.java +++ b/src/com/reason/ide/insight/provider/JsxNameCompletionProvider.java @@ -38,7 +38,7 @@ public static void addCompletions(@NotNull PsiElement element, @NotNull Completi PsiFinder psiFinder = PsiFinder.getInstance(project); Collection modules = psiFinder.findComponents(scope); - LOG.debug("Modules found", modules.size()); + LOG.debug("Modules found", modules); for (PsiModule module : modules) { boolean isInner = module instanceof PsiInnerModule; String moduleName = isInner ? module.getName() : ((FileBase) module).asModuleName(); diff --git a/src/com/reason/ide/search/PsiFinder.java b/src/com/reason/ide/search/PsiFinder.java index 58d9c2b3f..2719a2b75 100644 --- a/src/com/reason/ide/search/PsiFinder.java +++ b/src/com/reason/ide/search/PsiFinder.java @@ -1,5 +1,9 @@ package com.reason.ide.search; +import java.util.*; +import java.util.stream.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; @@ -14,15 +18,27 @@ import com.reason.bs.Bucklescript; import com.reason.ide.files.FileBase; import com.reason.ide.files.FileHelper; -import com.reason.ide.search.index.*; +import com.reason.ide.search.index.ExceptionFqnIndex; +import com.reason.ide.search.index.IndexKeys; +import com.reason.ide.search.index.LetFqnIndex; +import com.reason.ide.search.index.ModuleComponentIndex; +import com.reason.ide.search.index.ModuleFqnIndex; +import com.reason.ide.search.index.ParameterFqnIndex; +import com.reason.ide.search.index.ValFqnIndex; +import com.reason.ide.search.index.VariantFqnIndex; +import com.reason.ide.search.index.VariantIndex; import com.reason.lang.core.ORFileType; -import com.reason.lang.core.psi.*; +import com.reason.lang.core.psi.PsiException; +import com.reason.lang.core.psi.PsiExternal; +import com.reason.lang.core.psi.PsiInnerModule; +import com.reason.lang.core.psi.PsiLet; +import com.reason.lang.core.psi.PsiModule; +import com.reason.lang.core.psi.PsiParameter; +import com.reason.lang.core.psi.PsiRecordField; +import com.reason.lang.core.psi.PsiType; +import com.reason.lang.core.psi.PsiVal; +import com.reason.lang.core.psi.PsiVariantDeclaration; import gnu.trove.THashMap; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.*; -import java.util.stream.Collectors; import static com.intellij.psi.search.GlobalSearchScope.allScope; import static com.reason.lang.core.ORFileType.interfaceOrImplementation; @@ -64,18 +80,17 @@ public Collection findComponents(@NotNull GlobalSearchScope scope) { return Collections.emptyList(); } - FileModuleIndexService fileModuleIndexService = FileModuleIndexService.getService(); - ModuleComponentIndex index = ModuleComponentIndex.getInstance(); PsiManager psiManager = PsiManager.getInstance(project); Bucklescript bucklescript = ServiceManager.getService(m_project, Bucklescript.class); - List result = fileModuleIndexService.getComponents(project, scope). + List result = FileModuleIndexService.getService().getComponents(project, scope). stream(). filter(bucklescript::isDependency). map(vFile -> (FileBase) psiManager.findFile(vFile)). filter(Objects::nonNull). collect(Collectors.toList()); + ModuleComponentIndex index = ModuleComponentIndex.getInstance(); result.addAll(index.getAllKeys(m_project). stream(). map(key -> index.getUnique(key, m_project, scope)). @@ -219,7 +234,9 @@ public Collection findExternals(@NotNull String name, @NotNull ORFi } @NotNull - private Collection findLowerSymbols(@NotNull String debugName, @NotNull String name, @NotNull ORFileType fileType, @NotNull StubIndexKey indexKey, @NotNull Class clazz, @NotNull GlobalSearchScope scope) { + private Collection findLowerSymbols(@NotNull String debugName, @NotNull String name, @NotNull ORFileType fileType, + @NotNull StubIndexKey indexKey, @NotNull Class clazz, + @NotNull GlobalSearchScope scope) { Map implNames = new THashMap<>(); Map intfNames = new THashMap<>();