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
The suggestion is basically to implement the Inline Symbol refactor that already exists in JetBrains IDEs.
As the article linked above shows, there are several types of symbols that can be inlined, but a good idea would be to start with the Inline Variable refactor, as it's likely to be the simplest one.
The Inline Symbol refactor, when applied on message (the VariableDeclarator['id']), would replace the instances where the identifier is referenced with the expression that message is assigned to (the VariableDeclarator['init']).
Basically, just like Extract Constant, this refactor's main purpose is to reduce time spent making boilerplate-y operations that could be entirely automatic.
Although I'm not a fan of WebStorm, I've used IntelliJ heavily, and the refactorings available there are really top-notch. They save a serious amount of time. For reference, from colleagues using WebStorm, I know these refactorings are implemented for JS/TS as well, so that's proof to me there's no technically blocker from getting it done.
I'd have contributed all the missing refactorings, but that's a bit far, so I'd like to start with the seemingly (I assume it'll be harder than I imagine) easiest one, with the smallest scope.
The text was updated successfully, but these errors were encountered:
This means that you can't really argue that it can be done automatically, since it carries risks.
I think that you can probably get away with it if you only do it for literals ('Something happened!', true, 3, etc), but any calls or derefs to object properties or variables is going to be risky.
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
The suggestion is basically to implement the Inline Symbol refactor that already exists in JetBrains IDEs.
As the article linked above shows, there are several types of symbols that can be inlined, but a good idea would be to start with the
Inline Variable
refactor, as it's likely to be the simplest one.π Motivating Example
Consider the following code:
The
Inline Symbol
refactor, when applied onmessage
(theVariableDeclarator['id']
), would replace the instances where the identifier is referenced with the expression thatmessage
is assigned to (theVariableDeclarator['init']
).This would be the output:
π» Use Cases
Basically, just like
Extract Constant
, this refactor's main purpose is to reduce time spent making boilerplate-y operations that could be entirely automatic.Although I'm not a fan of WebStorm, I've used IntelliJ heavily, and the refactorings available there are really top-notch. They save a serious amount of time. For reference, from colleagues using WebStorm, I know these refactorings are implemented for JS/TS as well, so that's proof to me there's no technically blocker from getting it done.
I'd have contributed all the missing refactorings, but that's a bit far, so I'd like to start with the seemingly (I assume it'll be harder than I imagine) easiest one, with the smallest scope.
The text was updated successfully, but these errors were encountered: