Support folding + blocks in editor

i’d like to be able to build some blocks and use them to fold code, similar to what can be done in a regular text editor, using indents, for instance.
i usually use some sort of html-style syntax to do that, e.g.

	// <get code>
		delim1="code="
		delim1Len=length(delim1)
		beginPos=position(delim1,serverResponse) + delim1Len // skip "?code="
		delim2="&state="
		endPos=position(delim2,serverResponse)
		strLen=endPos-beginPos
		code=substring(serverResponse,beginPos,strLen)
	// </get code>

here, i’ve added a block, and indented the code inside of the block. now i’d like to be able to fold it, and if possible, use a shortcut to fold/unfold. ST even goes a step further, with command-k+number telling the editor how deep to fold, but i’d settle for just a command-k to fold and unfold everything further in than the cursor.
the folds can also make comments less annoying. one of the routines in my project has fifteen lines of declarations. i don’t necesarily need to see those, all the time.

1 Like