Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71a7f08

Browse files
authored
Merge pull request#1141 from lieryan/fix-move-refactoring
Fix Global and Module MoveRefactoring
2 parents149ccf7 +b70ec57 commit71a7f08

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

‎doc/pymode.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,31 @@ code to call it instead.
618618
let g:pymode_rope_use_function_bind = '<C-c>ru'
619619
620620
621-
Movemethod/fields~
621+
Moverefactoring~
622622
*pymode-rope-move*
623623

624+
Moving method/fields
625+
624626
It happens when you perform move refactoring on a method of a class. In this
625627
refactoring, a method of a class is moved to the class of one of its
626628
attributes. The old method will call the new method. If you want to change all
627629
of the occurrences of the old method to use the new method you can inline it
628630
afterwards.
631+
632+
Moving global variable/class/function into another module
633+
634+
It happens when you perform move refactoring on global variable/class/function.
635+
In this refactoring, the object being refactored will be moved to a destination
636+
module. All references to the object being moved will be updated to point to
637+
the new location.
638+
639+
Moving module variable/class/function into a package
640+
641+
It happens when you perform move refactoring on a name referencing a module.
642+
In this refactoring, the module being refactored will be moved to a destination
643+
package. All references to the object being moved will be updated to point to
644+
the new location.
645+
629646
>
630647
let g:pymode_rope_move_bind = '<C-c>rv'
631648

‎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
returnmove.create_move(ctx.project,ctx.resource,offset)
703703

704+
@staticmethod
705+
defget_changes(refactor,input_str,in_hierarchy=False):
706+
withRopeContext()asctx:
707+
ifisinstance(refactor, (move.MoveGlobal,move.MoveModule)):
708+
dest=ctx.project.pycore.find_module(input_str)
709+
else:
710+
dest=input_str
711+
returnsuper(MoveRefactoring,MoveRefactoring).get_changes(refactor,dest,in_hierarchy=in_hierarchy)
712+
704713

705714
classChangeSignatureRefactoring(Refactoring):
706715

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp