mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
for out-of-project files, resolve imports from SDK selected for project
This commit is contained in:
@@ -410,8 +410,24 @@ public class ResolveImportUtil {
|
||||
if (elt_psifile != null) { // formality
|
||||
final VirtualFile elt_vfile = elt_psifile.getVirtualFile();
|
||||
if (elt_vfile != null) { // reality
|
||||
for (OrderEntry entry : ProjectRootManager.getInstance(elt.getProject()).getFileIndex().getOrderEntriesForFile(elt_vfile)) {
|
||||
if (!visitOrderEntryRoots(visitor, entry)) break;
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(elt.getProject()).getFileIndex();
|
||||
final List<OrderEntry> orderEntries = fileIndex.getOrderEntriesForFile(elt_vfile);
|
||||
if (orderEntries.size() > 0) {
|
||||
for (OrderEntry entry : orderEntries) {
|
||||
if (!visitOrderEntryRoots(visitor, entry)) break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// out-of-project file - use roots of SDK assigned to project
|
||||
final Sdk sdk = PyBuiltinCache.findSdkForFile(elt_psifile);
|
||||
if (sdk != null) {
|
||||
final VirtualFile[] roots = sdk.getRootProvider().getFiles(OrderRootType.CLASSES);
|
||||
for (VirtualFile root : roots) {
|
||||
if (!visitor.visitRoot(root)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user