mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-83395: Reuse context for resolving source roots
GitOrigin-RevId: 0e8111679f8fd385fb11daf3d9ad7c1ed893bb60
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bc44941983
commit
9a7f2179d9
@@ -1758,7 +1758,7 @@ python.sdk.read.only=Python SDK ''{0}'' is read-only and operation cannot be per
|
||||
|
||||
python.source.root.detection.notification.group=Python source root detection
|
||||
python.source.root.detection.confirm.notification.group=Python source root detection
|
||||
python.source.root.detection.confirm.notification.title=''{0}'' has been marked as source root.
|
||||
python.source.root.detection.confirm.notification.title=''{0}'' has been marked as source root
|
||||
python.source.root.detection.confirm.notification.action.ok=Ok
|
||||
python.source.root.detection.confirm.notification.action.revert=Revert
|
||||
python.source.root.detection.confirm.notification.action.mute=Don't show again
|
||||
|
||||
@@ -1373,6 +1373,6 @@ INSP.unnecessary.cast.message=Unnecessary cast; type is already ''{0}''
|
||||
QFIX.remove.cast.call=Remove 'cast' call
|
||||
|
||||
# Quick fix: mark directory as source root
|
||||
QFIX.add.source.root.notification.text=''{0}'' has been marked as source root.
|
||||
QFIX.add.source.root.notification.text=''{0}'' has been marked as source root
|
||||
QFIX.add.source.root.notification.ok=Ok
|
||||
QFIX.add.source.root.notification.revert=Revert
|
||||
|
||||
+12
-12
@@ -137,24 +137,24 @@ class PyUnresolvedReferencesInspection : PyUnresolvedReferencesInspectionBase()
|
||||
|
||||
val filesByName = FilenameIndex.getVirtualFilesByName(folderNameToSearchFor, scope)
|
||||
|
||||
val context = fromModule(module)
|
||||
.copyWithoutStubs()
|
||||
.copyWithoutRoots()
|
||||
.run {
|
||||
// resolve members only for 'from .. import ..'
|
||||
if (importStatementBase is PyAstFromImportStatement) {
|
||||
copyWithMembers()
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
for (file in filesByName) {
|
||||
val containingDirectory = file.getParent() ?: continue
|
||||
|
||||
if (isAlreadySourceRoot(containingDirectory, module)) {
|
||||
continue
|
||||
}
|
||||
|
||||
val context = fromModule(module)
|
||||
.copyWithoutStubs()
|
||||
.copyWithoutRoots()
|
||||
.run {
|
||||
// resolve members only for 'from .. import ..'
|
||||
if (importStatementBase is PyAstFromImportStatement) {
|
||||
copyWithMembers()
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
val resolveResult: List<PsiElement> = resolveInRoot(qname, containingDirectory, context)
|
||||
if (!resolveResult.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user