Skip to content

Commit

Permalink
Fix MoveRefactoring
Browse files Browse the repository at this point in the history
Global and Module Move refactoring requires that `dest` be a rope
module, while Method Move refactoring requires that `dest` be an
attribute name.
  • Loading branch information
lieryan committed Sep 2, 2021
1 parent 4bc4581 commit 0c47c69
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pymode/rope.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,15 @@ def get_refactor(ctx):
offset = None
return move.create_move(ctx.project, ctx.resource, offset)

@staticmethod
def get_changes(refactor, input_str, in_hierarchy=False):
with RopeContext() as ctx:
if isinstance(refactor, (move.MoveGlobal, move.MoveModule)):
dest = ctx.project.pycore.find_module(input_str)
else:
dest = input_str
return super(MoveRefactoring, MoveRefactoring).get_changes(refactor, dest, in_hierarchy=in_hierarchy)


class ChangeSignatureRefactoring(Refactoring):

Expand Down

0 comments on commit 0c47c69

Please sign in to comment.