[TxMt] Minor update request to Python Bundle

Steve Lianoglou lists at arachnedesign.net
Tue Sep 12 02:02:59 UTC 2006


Hey there,

Can we update the Python Language definition in order to add folding  
markers for python docstrings (particularly for long function  
docstrings)?

Since there is an explicit beginning and end marker for these, I  
reckon this should be pretty easy, but I'm not sure how to add it in  
the face of that foldingStartMarker regex I see in the Python bundle  
(I have the latest one from SVN).

So, the convention (from what I understand) is this:

A long doc strings for a function looks like so:
----- python code -------
def my_function(param1, param2):
     """This function does xyz

     There is some long documentation here
     ...
     ...
     ... blah blah ...
     ....
     """"
     # real python code here
-----------------------------

So, something like adding a fold start and stop marker for """ could  
do the trick (the indentation levels should be the same for start and  
stop """ when folding is necessary).

Of course you can have this:
-----------
def my_function(param1, param2):
     """Short docstring""""
     # real python code here
----------

So I don't know if that will hose it any, but I'm guessing it would  
be ok since you can one-line { .. } code in languages that have brace  
begin/end block markers.

Thanks,
-steve



More information about the textmate mailing list