
TextMate can fold pieces of code - this is convenient, because allows you to look at the code entirely. Unfortunately, by default in JavaScript it collapses only functions, and sometimes you want to collapse other large structures (conditions / cycles / objects / lists)
To make it possible, you need to correct the conditions for finding the boundaries of the blocks.
To do this, open the settings editor (Bundles โ Bundle Editor โ Show Bundle Editor)
There we find a node with the necessary language settings (JavaScript โ JavaScript)
Replacing the values โโof foldingStartMarker with
'^. * (\ {| \ [) \ S * $' , and foldingStopMarker with
'^ \ s * (\} | \])' - i.e. everything wrapped in braces or brackets will collapse
')
update: corrected version:
foldingStartMarker = '(\{|\[|\()\s*$';
foldingStopMarker = '(^\s*(\}|\]|\))[,;]?)';