VS Code: Prevent Single-Child Folders from Being Merged

Last updated on October 2, 2021 A Goodman Loading... Post a comment

In recent versions of VS Code (Visual Studio Code), if a folder has only a child folder (this child can also be the parent of another folder) , both the parent and the child will be automatically merged and placed in a single line. You can see the screenshot below to get more clarity:

Many developers don’t want the single-child folders to be collapsed like that. On the contrary, they want each folder to occupy a separate like. If you are among these developers, the steps below will help you.

1. Open your VS Code then:

  • Go to File > Preferences > Settings if you are on a Windows computer (hotkeys: Ctrl + ,).
  • Navigate to Code > Preferences > Settings if you are using a Mac (hotkeys: Command + ,).

2. Type compact folder into the search field and uncheck the checkbox in the Explorer: Compact Folders section. If you get confused then see the screenshot below:

3. Now all the single-child folders are displayed in multiple lines as a tree:

Now you get your VS Code behaved in the way you want. If you’d like to explore more tips and tricks about this awesome IDE, take a look at the following articles:

If you have any questions, feel free to leave a comment. I will try my best to help. Happy coding!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Articles