mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed updates of qualified references to modules in move module refactoring (PY-6466)
This commit is contained in:
@@ -85,9 +85,14 @@ public class PyMoveFileHandler extends MoveFileHandler {
|
||||
}
|
||||
else if (element instanceof PyReferenceExpression) {
|
||||
updatedFiles.add(file);
|
||||
final PyQualifiedName newElementName = PyQualifiedName.fromComponents(PyClassRefactoringUtil.getOriginalName(newElement));
|
||||
replaceWithQualifiedExpression(element, newElementName);
|
||||
PyClassRefactoringUtil.insertImport(element, newElement, null);
|
||||
if (((PyReferenceExpression)element).getQualifier() != null) {
|
||||
final PyQualifiedName newQualifiedName = ResolveImportUtil.findCanonicalImportPath(newElement, element);
|
||||
replaceWithQualifiedExpression(element, newQualifiedName);
|
||||
} else {
|
||||
final PyQualifiedName newName = PyQualifiedName.fromComponents(PyClassRefactoringUtil.getOriginalName(newElement));
|
||||
replaceWithQualifiedExpression(element, newName);
|
||||
PyClassRefactoringUtil.insertImport(element, newElement, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from p1 import m1
|
||||
from p1.m1 import foo
|
||||
import p1.m1
|
||||
import p1
|
||||
|
||||
m1.foo
|
||||
p1.m1.foo
|
||||
m1.bar
|
||||
m1
|
||||
foo
|
||||
@@ -1,7 +1,8 @@
|
||||
from nonp3 import m1
|
||||
from nonp3.m1 import foo
|
||||
import nonp3.m1
|
||||
|
||||
m1.foo
|
||||
nonp3.m1.foo
|
||||
m1.bar
|
||||
m1
|
||||
foo
|
||||
Reference in New Issue
Block a user