Code Folding in PHP editor
By Petr on Jul 18, 2008
What is code folding? I have looked for a definition and I have found this at wikipedia:
Code folding is a feature of some text editors, source code editors and IDEs that allows the user to selectively hide and display sections of a currently-edited file as a part of routine edit operations. This allows the user to manage large regions of potentially complicated text within one window, while still viewing only those subsections of the text that are specifically relevant during a particular editing session.
The PHP editor, like other editors in NetBeans, provides this functionality. By default no fold is collapsed. The setting you can specify in general editor options (Tools -> Options -> Editor). On the picture below you can see which folds are supported in PHP and how they are mapped in editor options.
When you collapse a fold, you can see the hidden content, if you place the mouse cursor over the fold description.
The PHP editor also supports custome folds, which are defined by user. At the line, where you want to start the fold, place comment //<editor-fold> and at line where the fold should end place //</editor-fold>. Content between these tags, will be folded. These folds can be also nested.
The functionality, which provides the custome folds, is available from today. It is available in development builds or you have to wait until NetBeans 6.5 Milestone 2 will be published.