The hidden power of option-click in vscode explorer

hustnzj發表於2022-09-10

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.

The hidden power of option-click in vscode explorer

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!

References

Explorer: allow to expand a sub-tree fully via Alt-click · Issue #9456 · microsoft/vscode

本作品採用《CC 協議》,轉載必須註明作者和本文連結
日拱一卒

相關文章