Skip to content
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

Don't re-create rules on each refactoring iteration #30

Open
matejsp opened this issue Apr 20, 2022 · 1 comment
Open

Don't re-create rules on each refactoring iteration #30

matejsp opened this issue Apr 20, 2022 · 1 comment
Labels

Comments

@matejsp
Copy link

matejsp commented Apr 20, 2022

I am missing global state per file.
For example:
Renaming a method

  • update import
  • rename usages

I have a Rule derived class that finds the correct Import and returns a ReplacementAction.
I would need to store an alias into some file global context and match all the ast.Call to create ReplacementAction.

Now any data stored inside Rule or context provider is recreated after every ReplacementAction ...

@matejsp
Copy link
Author

matejsp commented Apr 20, 2022

Basically:
rules = self._initialize_rules(tree, source, file)

should be run outside and before _run ...
there is probably no need to recreate rules after each change?

@isidentical isidentical changed the title Global state per file Don't re-create rules on each refactoring iteration Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants