

Try this feature in PhpStorm & WebStorm 4.0 EAP.
Webstorm javascript code#
Keep your code clean and readable even without any extra folding regions. I would like also to stress that using custom folding regions is not a panacea from a badly structured code.

I guess it’s needless to say that mixing custom region styles in one project is a bad practice. The IDE will recognize only the first it can find and assume this is a style you have chosen for your code. Note that you can not mix up two styles in one file. When used with function calls, it returns undefined if the given function does not exist. In general the IDE uses typical language line comments for any kind of style. chaining operator, except that instead of causing an error if a reference is nullish ( null or undefined ), the expression short-circuits with a return value of undefined. The whole code gets hidden behind “My description”, the text I have specified as a value of “desc” attribute.”defaultstate” attribute is supported too but not added automatically.įor VisualStudio-like range comments PhpStorm/WebStorm adds “//” comment instead of “#” although “#range” is recognized too. Now I can collapse the region just like any other code folding region: If you don’t have any custom folding regions yet, you can choose either style. I press Ctrl+Alt+T now to get “surround with” action options:Īs you can see there are two custom folding items: “” for NetBeans-like style and “region.endregion” for VisualStudio style. I start with the following code and select a code region I would like to fold: This long-awaited feature gives you a possibility to define your own code-folding regions with special line comments.
