You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
aghArdeshir
changed the title
Refactor idea: Refactor function to module scope, but preserve the function itself (with arguments)
Refactor idea: Refactor function to module scope, but preserve the function itself (with/out arguments)
Jul 4, 2022
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?
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.
The text was updated successfully, but these errors were encountered: