X

An Oracle blog about NetBeans for PHP

Improved Code Folding

Hi all! Today we would like to introduce you a new NetBeans 7.2 feature which was very discussed in our BugZilla and had a lot of votes. It was an issue about Code Folding of other PHP structures then just classes, methods and comments.

It wasn't implemented in PHP Editor, because Java Editor didn't support that either. But you, our users, forced us to implement that for you. So now, here it is!

Now you can use code folding for if, else, elseif, do, while, for, foreach, switch, case, try and catch.

Improved Code Folding

That's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (component php, subcomponent Editor). Thanks.

Join the discussion

Comments ( 20 )
  • guest Tuesday, February 28, 2012

    GREAT!

    Will be a nice boost for us who were getting irritated with the buggy old one :P

    //Wasseem


  • Mathew Wednesday, February 29, 2012

    Hi

    This is great & I find it very useful in PHP. I wonder wheather it is possible to add the same in C++ module too.

    Regards,

    Mathew


  • guest Friday, March 2, 2012

    Nice Feature.

    I've updated Netbeans Dev 7.2 (20100302) using the buildin updater.

    While the other newer Features (like the PHP-Buildin webserver support) are avaible afterwards, the new code folding is not.


  • nikosch Tuesday, March 13, 2012

    Yippppie!


  • guest Saturday, March 17, 2012

    Hi,

    Can I know how we can add the same feature in C++ module?

    Currently it is the most importantly missing feature.

    Any help to add this into C++ wil be much appreciated.

    Mathew


  • Ondrej Brejla Monday, March 19, 2012

    Hi,

    you should ask C++ team to implement it. Use their bugzilla - http://netbeans.org/bugzilla/enter_bug.cgi?product=cnd


  • Schlaefer Tuesday, May 29, 2012

    Hi.

    Is it possible to deactivate this or to recursively open all subfolds?

    I don't want to open nine folds when working on single method, and I also don't want to open all folds in a file.

    "Tags and Other Code Blocks" is not checked in Prefs->Editor->General, only "Methods".


  • Ondrej Brejla Wednesday, May 30, 2012

    Hi Schlaefer:

    >> Is it possible to deactivate this or to recursively open all subfolds?

    You can use just "right click in editor -> Code Folds -> ..." or "View -> Code Folds -> ..." for some global handling of folds.

    >> "Tags and Other Code Blocks" is not checked in Prefs->Editor->General, only "Methods".

    Yes, because all "control structures" are binded to "Method" option. "Tags and Other Code Blocks" is used for folding of classes :( I have already file a bug against CSL infrastructure (http://netbeans.org/bugzilla/show_bug.cgi?id=213107) (which manages folding for PHP, JS, HTML, etc.) to allow us to use the "Inner Class" option for classes, so then "Tags and Other Code Blocks" can be free for folding of "control structures".


  • Schlaefer Wednesday, May 30, 2012

    Hi Ondrej.

    » You can use just "right click in editor -> Code Folds -> ..." or "View -> Code Folds -> ..." for some global handling of folds.

    With this new folding behavior Netbeans imho needs a command for recursive folding. Vim for example provides (http://vimdoc.sourceforge.net/htmldoc/fold.html ):

    1. open fold under cursor (zo)

    2. open folds under cursor recursively (zO)

    3. open all folds (zR)

    Netbeans currently offers only 1. and 3.

    » I have already file a bug against CSL infrastructure

    Thanks. Voted, hope that helps. :)


  • Ondrej Brejla Wednesday, May 30, 2012

    >> With this new folding behavior Netbeans imho needs a command for recursive folding.

    You can file an enhancement for Editor/Code Folding - http://netbeans.org/bugzilla/enter_bug.cgi?product=editor :)


  • Schlaefer Wednesday, May 30, 2012

    » You can file an enhancement for Editor/Code Folding

    Done: http://netbeans.org/bugzilla/show_bug.cgi?id=213218


  • guest Monday, July 9, 2012

    Works like a charm!

    Thank you!


  • guest Tuesday, July 31, 2012

    Hi,

    I dont need this "if, else, elseif, do, while, for, foreach, switch, case, try and catch." Code Folding. I do not like it. Please give us a setting possibility to switch this new "if, else etc." Code Folding on or off (in global Settings please).

    best regards

    max (from Germany)


  • Ondrej Brejla Tuesday, July 31, 2012

    Hi, it is handled by "Methods" option in Tools->Options->Editor->Code Folding. It can't have its own option in the current implementation. Please vote for this issue http://netbeans.org/bugzilla/show_bug.cgi?id=213107 to force the implementation so we can handle "methods" and "other tags" (if, else, etc.) separately. Thanks.


  • flamasta Sunday, August 5, 2012

    I just upgraded to newest Netbeans and this 'feature' annoys hell out of me, it is just completely wrong, please fix it by either separating 'methods' and control structures or just removing it.


  • PHP Coder Wednesday, August 22, 2012

    I have to concur with the negative outcry. I need the ability to fold functions and methods but NOT anything inside them. Having to click open 20 folds (or make a mess with "Expand All") is just maddening. One step forward, two steps back...

    Please give us more granular control over folds in PHP!


  • Ondrej Brejla Thursday, August 23, 2012

    Hi flamasta,

    as I wrote in the previous comment, vote for issue http://netbeans.org/bugzilla/show_bug.cgi?id=213107

    Thanks for your response!


  • Blintzbug Friday, August 31, 2012

    I voted, hopefully this will be fixed in the next release. I have to keep code folding off or I waste huge amounts of time unfolding things. I also like the idea of folding methods but not all structures within.


  • Dede Sunday, October 7, 2012

    Hi there,

    I was use to code folding the way it was :)

    Is there any way to have only methode folding and not all of the if, while, switch... as an option ?

    Dede


  • Ondrej Brejla Monday, October 8, 2012

    Dede: it is fixed for 7.3.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services