Last Updated on January 18, 2021
If you have been using Visual Studio Code, you might have encountered that if you have a folder that only has a single folder inside, Visual Studio Code will automatically collapse both parent and child folders into a single line.
Actually, if you have a chain of subfolders that have only one folder inside, it will merge all folders into a single line, as you can see on the image below.

I used to solve this by adding a dummy file or folder just to have a better folder structure, but even that is annoying since there are extra files that you can see that you do not need.

To solve this collapsing of the folder structure to a single line for single parent/child folder, follow the steps below.
Steps to Disable the Collapsing of Single Folders to One Line in Visual Studio Code
Open Settings by clicking on File
>> Preferences
>> Settings
.

This will open the Settings Tab.

On Search settings
, type compact folders
.
Under Explorer: Compact Folders
, uncheck the checkbox.

This will automatically disable the showing of single folders into a compact form and have a better folder tree.
We hope this solution helps.