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

Conversation

lieryan
Copy link
Contributor
@lieryan lieryan commented Sep 28, 2021

Currently, when doing a refactoring operation, python-mode often display this four options:

[Pymode] Choose what to do:
1. perform
2. preview
3. perform in class hierarchy
4. preview in class hierarchy
Type number and <Enter> or click with the mouse (q or empty cancels): 

In many of the operations, 3 and 4 doesn't really do anything different than 1 and 2 and it's rather difficult to remember which operations you can actually do in_hierarchy with and which ones doesn't.

With this PR, we don't show these extraneous operations when they are not relevant for the current refactoring operation.

[Pymode] Choose what to do:
1. perform
2. preview
Type number and <Enter> or click with the mouse (q or empty cancels): 

@diraol
Copy link
Contributor
diraol commented Nov 25, 2022

Hi @lieryan sorry for the very long time to review it.
Can you post here a sample code and instructions for us to test it?

@lieryan
Copy link
Contributor Author
lieryan commented Nov 28, 2022

Hi @diraol, thanks for looking into this. The changed behavior here does not actually depend on the text on the Vim buffer, so it shouldn't matter what the code you have on the python file for testing this change. In any case, in the places where I've removed the in-hierarchy option, currently python-mode never passes those options to rope anyway (for example).

If you want a code sample that demonstrates what the in_hierarchy does though, it basically changes how rope finds members of a class that belongs to a class inheritance hierarchy:

class Fruit(abc.ABC):
    def eat(self):
        pass

class Apple(Fruit):
    def eat(self):
        pass

class Orange(Fruit):
    def eat(self):
        pass

When in_hierarchy=True, when renaming Orange.eat(), both Fruit.eat(), Apple.eat(), are considered the "same" symbol, so they're renamed as well. Otherwise, when in_hierarchy=False, only symbols that refers to Orange.eat() are renamed.

@diraol
Copy link
Contributor
diraol commented Jun 27, 2023
< 8000 table class="d-block user-select-contain" data-paste-markdown-skip>

👋🏽
Let's try to move with this one too!
This seems to be an easy conflict to handle.

@lieryan
Copy link
Contributor Author
lieryan commented Jun 28, 2023

Hi @diraol, thank you for looking into these PRs, I've updated this one against the latest develop and addressed the merge conflicts.

@diraol diraol merged commit c86c4db into python-mode:develop Jun 28, 2023
@lieryan lieryan deleted the lieryan-in-hierarchy branch June 28, 2023 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0