As shown below:

enter image description here

TextMate's Python mode can't detect the end of a Python function. As a result, the folding/unfolding action isn't working for Python code.

Is this a bug of the Python bundle? If so, are there any patches to resolve this issue?

link|improve this question

74% accept rate
feedback

2 Answers

up vote 3 down vote accepted

You have to make sure you undent the blank line between the function definitions, otherwise the language grammar will have trouble picking out the end of the function. It's not really a bug, just a limitation of TextMate's grammar engine and the fact that Python uses indentation to delineate blocks.

link|improve this answer
Yes, that was the reason! Thanks. – prosseek Sep 15 '10 at 23:08
feedback

further to mipadi's answer, if you have the textmate python bundle installed, you can select-all and use the "Cleanup Whitespace" command to automagically fix up most of the indentations in existing code so that the folding engine can find blocks.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.