[TxMt] folding comment blocks

Gavin Kistner gavin at refinery.com
Wed Oct 5 14:03:31 UTC 2005

On Oct 5, 2005, at 7:55 AM, Gavin Kistner wrote:
> On Oct 5, 2005, at 7:19 AM, David Jack Olrik wrote:
>> On 04/10/2005, at 23.26, Allan Odgaard wrote:
>>> Which would be foldable by using these patterns:
>>>     foldingStartMarker = '#\+';
>>>     foldingStopMarker = '#-';
> Out of curiosity, why doesn't this work (latest version of TextMate):
>     foldingStartMarker = '^\s*#.+\n(?=\s*#)';
>     foldingStopMarker  = '^\s*#.+\n(?!\s*#)';
To begin to answer my own question, it looks like it's the \n. That  
sort of makes sense, I suppose - how can TM know what line to fold on  
when the RegExp matches over multiple lines?

However, even placing that inside a lookahead doesn't work.

     foldingStartMarker = '^\s*#.+'  # This properly starts a fold
     foldingStartMarker = '^\s*#.+(?=\n)'  # This does not

As the lookahead assertion doesn't consume characters, I'm not sure  
why that fails...is it perhaps because each line is passed into the  
folding detector, with no context for the lines around it?

More information about the textmate mailing list