In Cloud9 (based on the Ace editor) I can define arbitrary code folding regions within comments, for example:
// Descriptor {
function() {
// Code
}
// }
Folds to:
// Descriptor {<->}
Try it here to see what I mean.
Is there an existing way to replicate this in Sublime?
Yes, you use
CMD+K+1
to fold at level 1,CMD+K+2
for level 2, etcCMD+K+J
will unfold allCMD+OPT+[
will fold / hide the current level of indendation,CMD+OPT+]
will unfold any of the yellow rectangle symbols at the end of a lineSelect the block of code and Hit "Ctrl + Shift + [" to fold. To unfold place pointer before the folded block and hit "Ctrl + Shift + ]"
here's an youtube video link: https://www.youtube.com/watch?v=80UUPMUAP-g
From http://wesbos.com/sublime-text-code-folding/
The thing you will have to remember is that Sublime Text's folding mechanism is dependent on code intention levels and not scope.