Home Download Buy Blog Forum Support

Code folding - doesn't use tmbundle foldingStartMarker?

Code folding - doesn't use tmbundle foldingStartMarker?

Postby geerlingguy on Wed Jun 27, 2012 10:19 pm

It seems that Sublime uses tmbundles for language definitions. When I was using TextMate, I modified the PHP.tmLanguage bundle so I could exclude comments from the code folding start/stop markers (foldingStartMarker / foldingStopMarker).

This way I could leave comments unfolded, but fold the functions and methods below them, like in the following code:

Code: Select all
/**
* Comment is here (unfolded even if I do a 'fold all').
*/
function my_function_here() {
  // This function would be folded if I did a 'fold all').
}


I changed the values in the PHP bundle for Sublime to what's below, but it seems to have no effect. The only thing I could find in Googling is an old/deprecated documentation page saying that those values weren't actually used by Sublime... but I would assume Sublime has some way to define start/stop markers for code folding, right?

Current code for folding:

Code: Select all
   <string>^#!.*(?&lt;!-)php[0-9]{0,1}\b</string>
   <key>foldingStartMarker</key>
   <string>(\{\s*$|&lt;&lt;&lt;HTML)</string>
   <key>foldingStopMarker</key>
   <string>(^\s*\}|^HTML;)</string>


For TextMate, being able to customize my folding markers was a handy solution for my particular code folding needs (see: http://stackoverflow.com/questions/7689965/collapse-all-php-functions-in-textmate). Am I missing something here?

Alternatively, is there some other way for me to only fold functions/methods, and not the comments above them?
geerlingguy
 
Posts: 2
Joined: Wed Jun 27, 2012 10:11 pm

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 36 guests