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?
Select 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/
To fold a block, place your cursor anywhere within the block you want
to fold. Now you just hit the folding keys to collapse that block.
Command + Option + [
The thing you will have to remember is that Sublime Text's folding mechanism is dependent on code intention levels and not scope.
Yes, you use CMD+K+1
to fold at level 1, CMD+K+2
for level 2, etc
CMD+K+J
will unfold all
CMD+OPT+[
will fold / hide the current level of indendation, CMD+OPT+]
will unfold any of the yellow rectangle symbols at the end of a line