Can phpStorm define legible areas of code (Visual Studio style areas)?

In Visual Studio, you can use #region and #endregion to pack code blocks defined by the developer.

I would like to see this functionality in PhpStorm, this is an ideal way to organize a large source file (for example, many interface implementations).

Can PhpStorm Behave That Way?

+8
phpstorm folding
source share
2 answers

Sorry, this is currently not possible.

Please vote and see this ticket: https://youtrack.jetbrains.com/issue/WI-261


UPDATE
Now it is implemented ( with PhpStorm v4 ). Read the PhpStorm blog for more details: http://blog.jetbrains.com/webide/2012/03/new-in-4-0-custom-code-folding-regions/


 //<editor-fold desc="Region"> // Your code goes here //</editor-fold> 

The default collapse state is also properly maintained (with PhpStorm v8, IIRC), although you must manually add this part yourself. eg.

 //<editor-fold defaultstate="collapsed" desc="Region"> 

#region syntax is also supported.

+13
source share

I also looked for this and found that it is available for use in version 4 of EAP.

Working example:

 // region Private members private $db; private $cache; // endregion 
+6
source share

All Articles