I don't know what I did, TextMate 2 expanded the entire files of my project in the sidebar. Now the performance drastically went down. I can't able to figure out how to collapse it.

I don't know what I did, TextMate 2 expanded the entire files of my project in the sidebar. Now the performance drastically went down. I can't able to figure out how to collapse it.

You can hold option while clicking the 'Disclosure Arrow' (the little arrow next to the directory name) to recursively collapse all subfolders.
To collapse all the directories without performing the action for every folder, do this:
control+tab to move the focus to the file drawer. command+up arrow to 'go up a level'. option and click the arrow next to your desired folder. Reference: http://wiki.macromates.com/FAQ/TextMate2
I don't have TextMate 2, but does selecting the top level items and pressing ⌥← work? That should be the standard shortcut for collapsing a node recursively but it's not supported by all list views.
what works for me is:
that should collapse all folders