This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142074

Summary: Code Folding for C++ conditional/loop blocks
Product: cnd Reporter: i386 <i386>
Component: EditorAssignee: ilia
Status: RESOLVED FIXED    
Severity: blocker CC: mathewfer
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 195925    
Bug Blocks:    

Description i386 2008-07-29 14:31:10 UTC
Hi,

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.

Regards,
Xiaofan
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
Hi 

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:

http://netbeans.org/bugzilla/buglist.cgi?product=cnd;component=Code%20folding;resolution=---;list_id=16030 

Here is code added for PHP:

http://hg.netbeans.org/web-main/rev/5d54999ddb46

Regards,

Mathew
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.

Cheers
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:

  if
  switch
  while
  for

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

... So:

    if (1) {
        printf("1");
    } else if (2) {
        printf("2");
    } else {
        printf("3");
    }

can be folded to

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

or

    if (1) {...3 lines} else if (2) {
        printf("2");
    } else {...3 lines}

etc.

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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f9460f574168
User: Ilia Gromov <ilia@netbeans.org>
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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4008113928b8
User: Ilia Gromov <ilia@netbeans.org>
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. ***