[TxMt] Re: Code folding question...

Eric O'Connell eric at bodytalksystem.com
Fri Aug 21 18:30:49 UTC 2009


Hi Keith,

I'm not sure there's a way to do it exactly the way you want, because  
the folding stop/start markers don't "know" about each other-- there's  
no way you could reference the captured name of your section from the  
start in the folding stop marker. So I kinda hacked it, and I got this  
to work:

/* { Section_Start test */

div#supercool {
font-size: 400%;
}

div#not-so-cool {
display:none;
}

/* Section_End test } */

Note the braces at the end and beginning of the braces... This works  
by adding to the start/stop markers:

	foldingStartMarker = '/\*\*(?!\*)|\{\s*($|/\*(?!.*?\*/.*\S))|\/\*.*?\ 
{';
	foldingStopMarker = '(?<!\*)\*\*/|^\s*\}|\}.*?\*\/';

I added everything from the final pipe "|" onward.. and these sections  
will nest.

Hope this helps,

Eric O'Connell
Lead Developer
-
eric at bodytalksystem.com
www.bodytalksystem.com

On Aug 21, 2009, at 11:06 AM, Keith Solomon wrote:

> I'm trying to set up a code folding rule that will let me fold  
> sections
> of CSS files I work on.  I usually define sections in my code like  
> this:
>
> /* Section_Start <section name> */
> ...
> /* Section_End <section name */
>
> I've got the Pragmatic book, and I've looked at the included bundles,
> but I can't figure out a working solution...anybody got some  
> pointers on
> how to accomplish this?
>
> Keith
>
> -- 
> Keith Solomon - ksolomon at gmail.com
> My Blog - http://reciprocity.be/
> My Flickr - http://www.flickr.com/photos/zarath0s/
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate




More information about the textmate mailing list