#269 Generic code folding

open
nobody
5
2007-11-30
2007-11-30
Don Taylor
No

Most of the requested work for [ 1221104 ] extend code folding has been completed except for a suggestion in the comments to allow for custom code folding.

This request suggests ways to fold whole chunks of code that contain anything - classes, functions, comments, blank space: the whole thing.

I have two UI proposals for this feature - they are not mutually exclusive so maybe both could be implemented.

(1) Lines that are contained in matching leading magic strings in comments can be used to mark the scope of a piece of code that can be folded. For example:

#@1 - The following code should be folded as one unit.
<lots of lines of code>
#@1

would fold down to:
#@1 - The following code should be folded as one unit.

(2)Have 'Fold code' as a right click menu item when a set of lines are selected in the editor. All of the selected lines would be folded down to just the first line.

In this case there is no need to annotate the program text with decorated comments.

When such a fold is unfolded then the recovered lines could be restored still selected so that they can be re-folded without having to re-select them manually. Otherwise unfolding would cause any 'fold' information to be lost.

Discussion

  • DNC
    DNC
    2012-04-15

    It's been a long time since work was done on code folding, and it looks like this was the only request not acted on, and it's still open. I'd like to bump this up. In particular, I would love to see (1) above.