File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,20 @@ fun getDirectoriesForSysPath(
271271 if (ancestor != null && ! sources.contains(ancestor))
272272 sources.add(ancestor)
273273
274+ // Collect sys.path directories with imported modules
275+ file.importTargets.forEach { importTarget ->
276+ importTarget.multiResolve().forEach {
277+ val element = it.element
278+ if (element != null ) {
279+ val directory = element.parent
280+ if (directory is PsiDirectory ) {
281+ sources.add(directory.virtualFile)
282+ }
283+ }
284+
285+ }
286+ }
287+
274288 var importPath = ancestor?.let { VfsUtil .getParentDir(VfsUtilCore .getRelativeLocation(file.virtualFile, it)) } ? : " "
275289 if (importPath != " " )
276290 importPath + = " ."
You can’t perform that action at this time.
0 commit comments