'Do not show root folder in the VSCode sidebar explorer

In my new laptop VSCode started to behave differently in comparison to my old laptop.

If i add only one folder to the workspace, I want the folder itself not to appear, only it's contents.

In the screenshot below, i'd want the workspace to directly have all the contents of iac-vcs folder, not nested them under the iav-vcs, as it is currently. It seems to me that's how my old VSCode setup behaved, can't replicate it again.

VSCode screen

My workspace config looks as follows:

{
    "folders": [
        {
            "path": "<absolut-path-to-added-folder>/iac-vcs/"
        }
    ],
    "settings": {
    }
}

And my user settings are as follows:

{
    "workbench.colorTheme": "Default Dark+",
    "editor.minimap.enabled": false,
    "workbench.editor.untitled.hint": "hidden",
    "explorer.confirmDelete": false,
    "explorer.compactFolders": false,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 50,
    "[python]": {
        "editor.rulers": [80]
    },
    "search.useReplacePreview": false,
    "editor.suggestSelection": "first",
    "python.languageServer": "Pylance",
    "python.linting.enabled": true,
}

How do I tell VSCode to get do not show iac-vcs in the sidebar if there is only single folder added to a workspace?

It is also important to note that if I save new workspace, I do get the expected results: enter image description here

But upon closing the window and loading the workspace again, it gets to the state I initially described.

Many thanks!



Solution 1:[1]

For a single-folder workspace just open the folder using File -> Open Folder..., then you will have the folder's contents in the explorer.

To ignore the .vscode folder, add the following to your workspace settings:

"files.exclude": {
    ".vscode": true,
}

For a more convenient GUI-based way you might use the Explorer Exclude extension.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1