8000 Don't display in_hierarchy options that are not relevant to the current refactoring operation by lieryan · Pull Request #1143 · python-mode/python-mode · GitHub
[go: up one dir, main page]

Skip to content

Don't display in_hierarchy options that are not relevant to the current refactoring operation #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions pymode/rope.py
822B
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,11 @@ def run(self):
if not input_str:
return False

code_actions = self.get_code_actions()
action = env.user_input_choices(
'Choose what to do:', 'perform', 'preview',
'perform in class hierarchy',
'preview in class hierarchy')
'Choose what to do:',
*code_actions,
)

in_hierarchy = action.endswith("in class hierarchy")

Expand All @@ -492,6 +493,12 @@ def run(self):
except Exception as e: # noqa
env.error('Unhandled exception in Pymode: %s' % e)

def get_code_actions(self):
return [
'perform',
'preview',
]

@staticmethod
def get_refactor(ctx):
""" Get refactor object. """
Expand Down Expand Up @@ -546,6 +553,14 @@ def get_input_str(self, refactor, ctx):

return newname

def get_code_actions(self):
return [
'perform',
'preview',
'perform in class hierarchy',
'preview in class hierarchy',
]

@staticmethod
def get_changes(refactor, input_str, in_hierarchy=False):
""" Get changes.
Expand Down Expand Up @@ -708,7 +723,7 @@ def get_changes(refactor, input_str, in_hierarchy=False):
dest = ctx.project.pycore.find_module(input_str)
else:
dest = input_str
return super(MoveRefactoring, MoveRefactoring).get_changes(refactor, dest, in_hierarchy=in_hierarchy)
return super(MoveRefactoring, MoveRefactoring).get_changes(refactor, dest)


class ChangeSignatureRefactoring(Refactoring):
Expand Down Expand Up @@ -737,6 +752,14 @@ def get_refactor(ctx):
return change_signature.ChangeSignature(
ctx.project, ctx.resource, offset)

def get_code_actions(self):
return [
'perform',
'preview',
'perform in class hierarchy',
'preview in class hierarchy',
]

def get_changes(self, refactor, input_string, in_hierarchy=False):
""" Function description.

Expand Down
0