Home Download Buy Blog Forum Support

Code Folding syntax definition

Code Folding syntax definition

Postby askeeve on Mon Jan 14, 2013 8:34 pm

Hi guys, I haven't posted in a little while (work got SUPER busy) but I wonder if someone could give me a quick bit of help understanding how you define in a Syntax file how code should be folded.

If I understand correctly, anything between what the foldingStartMarker matches and what the foldingStopmarker matches will be folded (or to put it another way, fold arrows will appear at matches for the foldingStartMarker and collapse the code until the foldingStopMarker match). However, I've noticed that there seem to be hierarchies of code folding (Fold Level in the Edit -> Code Folding sub-menu). This would be really useful in the language I'm writing for and if it's possible I'd love to make use of it. Can anybody explain (or point me to a doc or something) how you define the level of folding? And just to be clear, this would allow you to do nested folding correct?

Thanks in advance guys!
askeeve
 
Posts: 51
Joined: Wed Apr 18, 2012 1:33 pm

Re: Code Folding syntax definition

Postby adzenith on Tue Jan 15, 2013 1:55 am

I don't think Sublime Text looks at the tmlanguage start and end fold markers... I think it does its own folding based on indentation?
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Code Folding syntax definition

Postby askeeve on Thu Jan 17, 2013 8:15 pm

Oh man I'd msiread the docs. So there's no way to define custom folding points?
askeeve
 
Posts: 51
Joined: Wed Apr 18, 2012 1:33 pm

Re: Code Folding syntax definition

Postby adzenith on Fri Jan 18, 2013 2:35 am

I don't think so... :(
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Code Folding syntax definition

Postby askeeve on Tue Jan 22, 2013 1:18 pm

Does anybody else have any idea? This would be a reeeeally useful feature. My company's proprietary language is pretty crazy to use, so I rely on ST2 to make my job bearable.
askeeve
 
Posts: 51
Joined: Wed Apr 18, 2012 1:33 pm

Re: Code Folding syntax definition

Postby Shammah on Fri Feb 22, 2013 3:08 pm

I'd really like syntax-enabled folding as well.
There's a lot of code I don't want to see, mainly in-line documentation.
It'd be great if I could creating syntax folders to hide it with something like #region and #endregion.
Shammah
 
Posts: 3
Joined: Tue Feb 12, 2013 8:51 pm

Re: Code Folding syntax definition

Postby adzenith on Fri Feb 22, 2013 6:28 pm

Shammah wrote:It'd be great if I could creating syntax folders to hide it with something like #region and #endregion.

I literally just finished reading this article: http://www.codinghorror.com/blog/2008/0 ... lding.html :)
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Code Folding syntax definition

Postby Shammah on Sat Feb 23, 2013 5:06 pm

adzenith wrote:I literally just finished reading this article: http://www.codinghorror.com/blog/2008/0 ... lding.html :)


Well, he has a fair point there. But I accept one use for 'code' folding and that's for my in-line documentation. When all of my methods, classes etc have more XML documentation than code and the documentation is very lengthy, I'd like to collapse these when working on the code in order to prevent my scroll wheel from dying and myself being able to comprehend the code. If I need to look up the documentation anyway, I can always expand or look up the extracted documentation files. I want to use the folding for the exact reason Jeff stated: I want to see my code!
Shammah
 
Posts: 3
Joined: Tue Feb 12, 2013 8:51 pm

Re: Code Folding syntax definition

Postby jokoon on Wed Feb 27, 2013 10:29 am

Could be nice to have the same code folding MSVC has (see attachment).
Attachments
Untitled.png
Untitled.png (9 KiB) Viewed 3256 times
jokoon
 
Posts: 1
Joined: Thu Jul 12, 2012 2:01 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 16 guests