Gurleen Sethi
Gurleen Sethi

Reputation: 3512

How to collapse sub-folders when a folder is closed in VS Code?

When I collapse a folder, I want the sub-folder to be collapsed as well. Right now when I collapse a folder and re-open it, the sub-folders stay as they were while the folder was being closed. I want the behaviour where collapsing the folder also collapses the sub-folders.

Upvotes: 15

Views: 7038

Answers (2)

Gama11
Gama11

Reputation: 34158

You can Alt+Click a folder to recursively expand or collapse it. There is an issue (currently in community voting phase) to allow setting this behavior as a default.

Upvotes: 21

VonC
VonC

Reputation: 1328642

The new 1.42 (Q1 2020) VSCode might help:

Two-step collapse in multi-root Explorer

When you are using a multi-root workspace, the Collapse Folder button in the File Explorer now has a two-step behavior, where:

  • the first click will collapse all folders within each top-level, and
  • the second click will collapse the top-level folders.

The Search view already has this behavior.

Two-step File Explorer collapse button -- https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_42/2-step-collapse.gif

Upvotes: 13

Related Questions