Is there a faster way to collapse all the code across all files in a project?
I'm afraid not. Looks like there are no built-in keyboard shortcuts or menu command to achieve it up to now after do some searching.
I would suggest you could raise a feature request. That will allow you to directly interact with the appropriate product group, and make it more convenient for the product group to collect and categorize your suggestions.