Bug 213218 - Recursive Code Folding and Unfolding
Recursive Code Folding and Unfolding
Status: RESOLVED DUPLICATE of bug 216226
Product: editor
Classification: Unclassified
Component: Code folding
7.2
All All
: P3 with 3 votes (vote)
: TBD
Assigned To: Svata Dedic
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-30 08:10 UTC by schlaefer
Modified: 2012-12-11 10:37 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schlaefer 2012-05-30 08:10:49 UTC
Netbeans 7.2 introduces support for folding if/for/try… statements in PHP [1][2].

This leads to the situation that if you want to see a method and this method has many if/for/try… blocks you have to open many subfolds before the whole method is shown.

Netbeans offers two folding actions at the moment: a) open/close fold under cursor and b) open/close all folds.

I propose a third action c) 'open/close fold under cursor and all its subfolds' which should work analog to vim's zO command [3]: it opens the fold under the cursor and all the subfolds it contains but does not affect any other folds in the same document.

---

[1]: https://blogs.oracle.com/netbeansphp/entry/improved_code_folding
[2]: http://netbeans.org/bugzilla/show_bug.cgi?id=186731 
[3]: http://vimdoc.sourceforge.net/htmldoc/fold.html
Comment 1 Svata Dedic 2012-05-30 08:18:31 UTC
Seems beneficial in case of complex fold structure; any idea for a gesture for this function ? 

I've already used "ctrl" modifier - ctrl-click expands/collapses next level if more folds occupy the same line.

Doubleclick on the fold sign ?
Comment 2 contrebis 2012-07-25 23:17:38 UTC
I use 'Collapse by Default: Methods' to give me a quick outline of the class when it opens. I find it easier to scroll through the file and inspect the class interface and PHPDoc. However, collapsing other control statements, as is now happening, just creates more clicks for me with no particular benefit.

For comparison, jEdit (www.jedit.org) allows expanding all child blocks with Shift + Click on the folds. (It also allows more flexible control over indentation and parsing, adjustable per file type, and per file if necessary, would love to see this flexibility in Netbeans.)
Comment 3 Svata Dedic 2012-07-31 11:47:33 UTC
(In reply to comment #2)
> I use 'Collapse by Default: Methods' to give me a quick outline of the class
> when it opens. I find it easier to scroll through the file and inspect the
> class interface and PHPDoc. However, collapsing other control statements, as is
> now happening, just creates more clicks for me with no particular benefit.

Note that this is not a new behaviour. PHP folding support uses 'code-block' type for both method-level and statement-level folding; the CSL fold infrastructure does not support additional types. When you switch 'fold methods', you actually affect all 'code-block' type folds, in PHP case both methods and if/else/while/... statement blocks.

First CSL should provide PHP with support to extend fold types. Then PHP should separate method/statement fold types, so they can be controlled independently.

Moving to CSL.
Comment 4 Svata Dedic 2012-07-31 11:50:23 UTC
Oops. 

The enhancement contains also core folding-related request, the comments #2 and #3 describe an unrelated issue, which seems to be covered e.g. by issue #157709. Moving back :) The CSL related part is alreay tracked.
Comment 5 Eccenux 2012-09-21 12:45:15 UTC
CTRL + click or CTRL + SHIFT + click would work for me. Would be even better if a user would be able to define it. Maybe a simple option like "CTRL+click (un)folds all levels recursively" (true/false).
Comment 6 Josselin 2012-09-22 10:30:36 UTC
For a keybord-only shortcut, CMD/CTRL + [+] is the actual shortcut for unfold
so CMD/CTRL + SHIFT + [+] would be nice for expand all children next to the actual position.
Comment 7 Svata Dedic 2012-12-11 10:37:39 UTC

*** This bug has been marked as a duplicate of bug 216226 ***


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