Search code examples
eclipsecode-folding

Is there any way to fold/collapse regional code in Eclipse?


I used this way to get code folding in Netbeans:

// <editor-fold defaultstate="collapsed" desc=" description">
....
// </editor-fold>

and Visual Studio:

#region description
...
#endregion

but I can't find the same usage in eclipse. How can I use code folding in Eclipse?


Solution

  • Eclipse supports code folding.

    Go to workbench preferences -> General -> Editors -> Structured Text Editors, and check the "Enable folding" box.

    Then go to workbench preferences -> Java -> Editor -> Folding, and adjust your folding preferences.