[TextMate] Problem with folding

Chris Brierley thebrier at gmail.com
Mon Oct 11 05:23:06 UTC 2004


I can't think of a way to get folding to work for Python code.  I
think it's because of the way folding is implemented in TextMate, so I
don't think it's possible, but I'm hoping someone can think of
something.

In Python, all blocks are delineated by indentation.  So, here's a
couple of blocks:

if 1:
    foo()
    bar()
else:
    fnord()

You'd want to be able to fold "if 1:" through "bar()" and be able to
fold "else:"  through "fnord()".  I can't think of any way to do this
with TextMate's folding implementation.

It's easy enough to set a foldingStartMarker -- any line ending with a
":" (simply speaking).  But what foldingStopMarker?  The "mark" is the
next line with the same indendation as the starting line, but that
line is *not* part of the fold.  You want the fold to end before that
line.

I'm tearing my hair out over here.  Can anyone think of a clever way
to do this?  Am I missing something, or is this just impossible with
the current implementation?

Thanks to anyone for help!



More information about the textmate mailing list