Skip to content

Commit 0c47c69

Browse files
committed
Fix MoveRefactoring
Global and Module Move refactoring requires that `dest` be a rope module, while Method Move refactoring requires that `dest` be an attribute name.
1 parent 4bc4581 commit 0c47c69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pymode/rope.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,15 @@ def get_refactor(ctx):
701701
offset = None
702702
return move.create_move(ctx.project, ctx.resource, offset)
703703

704+
@staticmethod
705+
def get_changes(refactor, input_str, in_hierarchy=False):
706+
with RopeContext() as ctx:
707+
if isinstance(refactor, (move.MoveGlobal, move.MoveModule)):
708+
dest = ctx.project.pycore.find_module(input_str)
709+
else:
710+
dest = input_str
711+
return super(MoveRefactoring, MoveRefactoring).get_changes(refactor, dest, in_hierarchy=in_hierarchy)
712+
704713

705714
class ChangeSignatureRefactoring(Refactoring):
706715

0 commit comments

Comments
 (0)