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
Hello, thanks for making this extension. I came across something, and I'm not sure if it would constitute a new feature or an enhancement.
In Javascript, when working in class methods, I need to make a constructor variable from an existing variable. The current split declaration/init doesn't consider classes.
Describe the solution you'd like
Some way to refactor an existing variable from within the method, into the class constructor with this. prefix.
A clear and concise description of what you want to happen.
It would be nice if Abracadabra could take the selected variable and split the declaration/init into the constructor.
It would replace the original let variable = some code inside the class method with this.variable = some code, and would create the declaration this.variable = null inside the constructor.
This feature would be identical to the existing feature but for a JS class.
There are some factors to consider that I can see:
The variable may appear in other methods that you may or may not want to change.
I think one way is to just split the variable, place it in the constructor, and then the dev/user would go through the methods, replacing the variable as necessary.
If further enhancement was worthwhile, an option could be added for the algorithm to go through all the methods inside the class, replacing the variable wherever it appears
Additional context
As a novice, I can't speak on the scope/complexity of a feature like this or its usability with other languages. There may also be ways of working I'm not aware of that would make a feature like this unnecessary or very difficult to implement. If not the case I think this would improve the extension.
The text was updated successfully, but these errors were encountered:
Hello, thanks for making this extension. I came across something, and I'm not sure if it would constitute a new feature or an enhancement.
In Javascript, when working in class methods, I need to make a constructor variable from an existing variable. The current split declaration/init doesn't consider classes.
Describe the solution you'd like
Some way to refactor an existing variable from within the method, into the class constructor with
this.
prefix.A clear and concise description of what you want to happen.
It would be nice if Abracadabra could take the selected variable and split the declaration/init into the constructor.
It would replace the original
let variable = some code
inside theclass method
withthis.variable = some code
, and would create the declarationthis.variable = null
inside the constructor.This feature would be identical to the existing feature but for a JS class.
would become
There are some factors to consider that I can see:
The variable may appear in other methods that you may or may not want to change.
I think one way is to just split the variable, place it in the constructor, and then the dev/user would go through the methods, replacing the variable as necessary.
If further enhancement was worthwhile, an option could be added for the algorithm to go through all the methods inside the class, replacing the variable wherever it appears
Additional context
As a novice, I can't speak on the scope/complexity of a feature like this or its usability with other languages. There may also be ways of working I'm not aware of that would make a feature like this unnecessary or very difficult to implement. If not the case I think this would improve the extension.
The text was updated successfully, but these errors were encountered: