Skip to content

Commit

Permalink
import Library by qualified name instead of simple name
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Apr 23, 2021
1 parent a0f3579 commit 99230ac
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.ProjectScope;
import com.intellij.psi.util.QualifiedName;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.stubs.PyModuleNameIndex;
import com.millennialmedia.intellibot.ide.config.RobotOptionsProvider;
Expand Down Expand Up @@ -84,8 +85,12 @@ public static PsiElement findPython(@Nullable String library, @NotNull Project p
addToCache(result, library);
return result;
}
debug(library, "Attemping module search", project);
List<PyFile> results = PyModuleNameIndex.find(library, project, true);
debug(library, "Attempting module search", project);
List<PyFile> results = PyModuleNameIndex.findByQualifiedName(
QualifiedName.fromDottedString(library),
project,
GlobalSearchScope.projectScope(project)
);
if (! results.isEmpty()) {
result = (PsiFile)results.get(0);
addToCache(result, library);
Expand Down

0 comments on commit 99230ac

Please sign in to comment.