My VS Code Explorer has some expanded folders, for example:
.
├── foo
│ ├── fizz
│ └── buzz
└── bar
Whenever I Alt+Tab or switch to another window, and then switch back to VS Code, it collapses my folders
.
├── foo
└── bar
It has only started doing this today, and is getting increasingly annoying, especially when I have many files in my project and need to find a specific one.
VS Code info:
Version: 1.85.0-insider (user setup)
Commit: c6b48c364dde70c12bf977f1da50acda0fd801e3
Date: 2023-11-30T05:35:40.559Z
Electron: 25.9.6
ElectronBuildId: 25427645
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621
This sounds like it could be a case of the problem in ALT + TAB causes Explorer tree view to fully collapse in multi root workspace #139462. If you can repro that issue, please add a comment with repro steps. The issue ticket is still open, but there's a linked issue ticket with a suggested workaround in the comments that you could try in the meantime: put "skipRefreshExplorerOnWindowFocus": true,
in your user settings.json file.
Otherwise, it could be a bug or a regression of a historical issue like https://github.com/microsoft/vscode/issues/136258, in which case you should raise a new issue ticket using the Help: Raise Issue
command in the command palette.
For your reference / learning purposes, those issue tickets were found by googling "github vscode issues explorer collapse OR expand alt+tab
".