refactor icon indicating copy to clipboard operation
refactor copied to clipboard

Don't re-create rules on each refactoring iteration

Open matejsp opened this issue 3 years ago • 1 comments

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 avatar Apr 20 '22 19:04 matejsp

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?

matejsp avatar Apr 20 '22 20:04 matejsp