#269 Generic code folding

Don Taylor

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>

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.


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


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks