One of the major techniques to keep your code in a good shape is refactoring it. In the latest Web IDE EAP (#470) you can try the just added Inline Variable JavaScript refactoring.
Inline Variable — replaces local variable occurrences with its initializing expression.
Before

After

The Inline Variable refactoring, by the way, also works in the left part of local variable assignment.
During the inline process, Web IDE verifies if a variable can be safely replaced and gives a warning if not, e.g. there are its usages inside a functional expression.

More JS refactorings are coming in next builds.
Develop with pleasure!
This blog is permanently closed.
For up-to-date information please follow to corresponding WebStorm blog or PhpStorm blog.
What is this color scheme and where take the same?
This one is ‘Thinmint’ from here: http://www.jetbrains.net/devnet/docs/DOC-1154
We are going to add a dark scheme to Web IDE in one of following builds
What about refactoring support for PHP?
Full set of refactorings is planned.
Currently only “Rename” is implemented (for files, constants, functions, classes, members, parameters and variables).
Alexey, that’s exiting. “Introduce variable” and “Inline variable” are probably the most common ones.
Do you plan to implement language injection in the first release? Obviously there are hundreds of candidates (literally) for injecting SQL language.
By the way, that example of refactoring the get cookie function is actually worse than before in the inline variable example – in the “after” shot, the cookie length is evaluated at every iteration in the while loop, instead of just once in the before shot.
@Dean: thanks for the feedback. The example is given just to demonstrate the refactoring but not as a recommendation to refactor this particular code. We realize all developers know their code and make a right decision about the refactorings.