The hidden power of option-click in vscode explorer
There is a common use case that you are working on a directory with many sub dirs and after a while it gets messy and you want to collapse all the sub dirs.
With the default
Collapse Folders in Explorer button as below, you can collapse all the folders in the explorer by clicking it one or more times.
But it don’t work if you want to collapse a specific folder.
Option-click is a hidden and ingenious feature that I happen to discover.
Option-click on an open folder will collapse all the sub dirs underneath it, and
Option-click on a closed folder will just open the folders that were previously opened.
The normal use case would be, if there is some emergency to work in another directory when I am working in a directory 5 levels down from the root, I can just
Option-click to collapse all the folders in Explorer to get a clean directory. Then after this emergent work’s done, I can just
Option-click on the root directory without navigating back down 5 levels to the directory I was working in. It’s like having a memory!