[TxMt] inconsistent python folding

Jeroen van der Ham jeroen at je-ju.net
Tue Oct 18 08:19:08 UTC 2005


Allan Odgaard wrote:
> On 18/10/2005, at 3.37, Chris Fonnesbeck wrote:
> 
>> After loading a python file into textmate, I noticed that the folding 
>> is very inconsistent [...] has this problem not been fixed in the past 
>> year?
> 
> It hasn't been fixed, and it's unlikely to be until 1.3.

Bit of context: creating foldings for python programs is hideously 
difficult if you don't include extra whitespace to aid the parser.

For example:

class someClass:
   def someMethod(self, foo, bar):
     foo = bar + 1

     return foo

The function folding close marker should come after return foo, but 
there's no way to know that it should be there if you don't include 4 
spaces on that line.

So the workaround for this is to include whitespace in your code. It's 
not ideal, but doing it any other way is far from trivial.

Jeroen.



More information about the textmate mailing list