Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 142074 - Code Folding for C++ conditional/loop blocks
Code Folding for C++ conditional/loop blocks
Product: cnd
Classification: Unclassified
Component: Editor
All All
: P3 with 7 votes (vote)
: 7.2
Assigned To: ilia
: 209041 209784 (view as bug list)
Depends on: 195925
  Show dependency treegraph
Reported: 2008-07-29 14:31 UTC by i386
Modified: 2015-04-28 10:15 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description i386 2008-07-29 14:31:10 UTC

It seems useful if we can fold in if/else statement in the code - e.g. when the statement is long, it would be good if
we can see the if (...) while writing the 'else' section, which means keeping the code inside the if(){ * } folded up.
The same applies to for/while loops, especially in the case of nested loops.

Comment 1 avp 2008-07-29 15:11:03 UTC
I think more universal is issue #121980 = for all {} brackets not only for loops and conditions
Comment 2 i386 2008-07-29 15:35:34 UTC
Yep, that's what I would have suggested if it does not pull down the editor's responsiveness.
Comment 3 i386 2008-07-29 15:37:42 UTC
And possibly for multi-line < > to fold in the hefty template definitions
Comment 4 avp 2008-07-29 16:12:01 UTC
Maybe would be better to have folding for all types brackets "(" "{" "<"?
I see such possibilities in dreamweaver cs - for html code - it's great feature. I think for C/C++ it would be also good.
Comment 5 Vladimir Voskresensky 2011-08-04 22:09:27 UTC
I think editor should provide an option if extra code folding is requested by user (issue 195925)
Comment 6 mathewfer 2012-02-29 02:37:21 UTC

Code folding has been added in PHP & is working in 7.2 dev (latest built)

Like it is done in PHP, can we please add this to C++ module as well?

Here is the discussion:;component=Code%20folding;resolution=---;list_id=16030 

Here is code added for PHP:


Comment 7 XO39 2012-05-22 22:28:39 UTC
Any news about this? This is the most irritating thing that bothers me with NetBeans so far.

Can you -please- add this feature whenever possible? That would be greatly appreciated.

Thanks! :)
Comment 8 MiDNiT3 2014-01-10 08:22:36 UTC
This feature is still wanted
Comment 9 rpears89 2014-02-27 11:43:19 UTC
I have been using Netbeans for some time. I have recently started using it for c++. This feature would greatly improve my coding experience. Please do add it.

Comment 10 laijiang 2014-04-23 07:09:50 UTC
It is bored that this is still not implemented.
Comment 11 patrickmoody84 2014-08-07 15:55:24 UTC
Another vote for implementing this enhancement.  I use MPLAB X, which is Microchip's IDE for firmware development, built on NetBeans.  Writing in embedded C, being able to fold code contained within pairs of {} would be hugely beneficial to my work.
Comment 12 ilia 2014-12-10 16:10:47 UTC
Partial fix in 281790:f9460f574168

Added folding support for:

* <keyword> ( condition ) { statement } ...
  where curly braces are optional and <keyword> is one of the:


* <keyword> { statement } ...
  where <keyword> is on of the:

... So:

    if (1) {
    } else if (2) {
    } else {

can be folded to

    if (1) {...3 lines} else if (2) {...3 lines} else {...3 lines}


    if (1) {...3 lines} else if (2) {
    } else {...3 lines}


Same for all other conditional statements, iteration statements etc
Comment 13 ilia 2014-12-11 15:50:03 UTC
Additional fixes in 281832:26ce02e6ed3e, 281850:ec2c3023dc0a
Comment 14 Quality Engineering 2014-12-12 03:50:57 UTC
Integrated into 'main-silver', will be available in build *201412120001* on (upload may still be in progress)

User: Ilia Gromov <>
Log: fixing Bug #142074 - Code Folding for C++ conditional/loop blocks
Comment 15 ilia 2014-12-16 11:58:41 UTC
Additional fix in 282073:4008113928b8
Comment 16 Quality Engineering 2014-12-17 05:11:17 UTC
Integrated into 'main-silver', will be available in build *201412170001* on (upload may still be in progress)

User: Ilia Gromov <>
Log: additional fix for Bug #142074 - Code Folding for C++ conditional/loop blocks
Comment 17 ilia 2015-04-28 10:15:39 UTC
*** Bug 209041 has been marked as a duplicate of this bug. ***
Comment 18 ilia 2015-04-28 10:15:53 UTC
*** Bug 209784 has been marked as a duplicate of this bug. ***

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo