[TxMt] improved javascript foldings

Caio Chassot k at v2studio.com
Wed Oct 5 18:03:34 UTC 2005


Hi all,

The following folding patterns for javascript will:

1. fold any line that contains a function, such as:
    - object literal style function declarations (ala rails prototype)
    - lambdas that you pass to your js implementations of map, select 
and inject
2. not think single-line functions mark a fold start

foldingStartMarker = 
'^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$';
foldingStopMarker  = '^\s*\}';

Hope you find it useful.

I tested it against a dozen or so js files of varied convolutedness and 
was quite satisfied, but if you find something wonky let me know.




More information about the textmate mailing list