[TxMt] python in TextMate question
Kumar McMillan
kumar.mcmillan at gmail.com
Wed Aug 17 19:04:21 UTC 2005
On 8/17/05, Jeroen van der Ham <jeroen at je-ju.net> wrote:
> On 17-08-2005 02:49, Jordan Breeding wrote:
> > I have a question about editing python in TextMate. Is it possible to
> > change the folding rules so that class/function definitions don't stop
> > folding when they encounter a blank line?
>
> Only if you use sufficient indentation on that blank line.
>
> TextMate parses files mostly line by line and makes syntax highlight and
> folding decisions based on that.
> This means that the only way to know if a blank line is for readability
> or delimiting a function or class is based on indentation.
On a quick glance at the Python.plist file it seems that the
foldingStopMarker looks for a blank line (for def|class entities). It
should be possible to use captures to find the indentation level, no?
in english:
foldingStartMarker: (captures preceding_whitespace_pattern)
foldingStopMarker: when line is not blank and not matching
{preceding_whitespace_pattern} + anything
I haven't decided if that will still work for dicts, lists, and tuples
... but this should fix defs and classes so they don't fold on blank
lines within the entity. I think the last entity in the file would
not get folded correctly though.
More information about the textmate
mailing list