[TxMt] python in TextMate question

Kumar McMillan kumar.mcmillan at gmail.com
Fri Aug 19 15:49:59 UTC 2005


Interesting.
Well, I tried putting my money where my mouth was and my pattern
doesn't seem to work :)
Here is what I tried ....

foldingStartMarker: (^\s*)(def|class)\s+([.a-zA-Z0-9_ b]+)\s*(\((.*)\))?\s*:
foldingEndMarker: ^(?!\s*$)(?!\1\s+.*$)

which was trying to accomplish:

foldingStartMarker: (captures indent_level)
foldingStopMarker: when line is not blank and not matching
{indent_level} + indent + anything

(obviously I stripped out the list, dict, and tuple patterns just for testing)

_

any ideas?


On 8/19/05, Jeroen van der Ham <jeroen at je-ju.net> wrote:
> On 19-08-2005 01:47, Douglas Livingstone wrote:
> > What about this code, folding should still work for the classes, not
> > just the functions:
> >
> >          class someClass:
> >                  def someFunction(args):
> >                          pass
> >                  .
> >          class someOtherClass:
> >                  def someOtherFunction(args):
> >                          pass
> >
> 
> I understand that that should work, but it doesn't because it's pretty
> difficult to define what the closing folding match would be.
> And as far as I know, there's no way to have both a closing and an
> opening folding on the same line (so matching "class" wouldn't work) and
> multiline matches are not supported in TextMate, so you can't do a look
> ahead search for class either.
> 
> Jeroen.
> --
>             <http://www.je-ju.net/~jeroen/blog/>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>



More information about the textmate mailing list