Closed aghArdeshir closed 2 years ago
Hi @aghArdeshir - thanks for the refactoring idea!
I'm unsure which P42 refactoring you are currently using - my guess is that you use an "extract to function in module scope" refactoring from VS Code (which would explain why it's an arrow function wrapped in a function).
With P42, you could use "extract const" as follows:
This would give you:
It's a bit different from your expected result however, because the extracted function is not at the top level. Is this closer to what you were looking for?
Yup. Sorry :+1: THat makes sense
Hi. Sometimes I use P42 for refactoring callbacks, so the code would be cleaner, but I always have to make a manual refactor to make it more performant. I want my callbacks to be preserved (instead of me
Initial:
Result:
Expected:
I'm not too familiar with this whole parsing and automatic refactoring thing and I don't know the thing I expect is possible or not. And I'm aware with arguments it will be more and more complicated But I believe the simple cases can be detected and put as an option.