Sublime Forum

Code Folding for a Function's Body

#1

Hi. We all know that Sublime has still to be improved in code folding features.
One of the features I used most in Zend Studio was to be able to fold all functions bodies inside a class, so you just see the class definition line and the lines where you write the functions names and their attributes. Something like:

//
class myClass{
//
function firstFunction($a,$b,$c) {…}
//
function secondFunction($a,$b,$c) {…}
//
function thirdFunction($a,$b,$c) {…}
}

I have not found a solution for this, but the best thing I have seen is the RegReplace Package http://facelessuser.github.io/RegReplace/usage/ but I have not been able to build a regular expression for collapsing the function’s body.

Maybe @facelessuser can help us.

Thank you

0 Likes

#2

I agree. The standard fold commands are pretty limited. It annoyed me so much I wrote my own plugin for that: https://github.com/LuckyKat/sublime-fold-functions (currently awaiting a pull request in package control)

However I wrote that for Javascript because I work mostly in it, Would be great if something like this is standard.

1 Like