How to collapse sub-folders when a folder is closed in VS Code? - visual-studio-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.

You can Alt+Click a folder to recursively expand or collapse it. However, I don't think it's possible to make that the default, since keybindings don't support mouse input.

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.

Related

how to make path folder arrange down in vscode explorer [duplicate]

If child folder is empty, vscode get them merged like on screenshot. Is there an option to disable it? It's confusing and harder to use for me.
Disable/uncheck Explorer: Compact Folders in your settings.
Related info from release notes: Is there a way to unify single-folder folders in vs code?
In VsCode on MAC go to Code (top left hand corner)
Select Preferences
then Settings
then Search for compact folders
Uncheck the
In VsCode on WINDOWS go to File (top left hand corner)
Select Preferences
then Settings (or you can simply press Ctrl/Cmd+,)
then search for Compact Folders
Unckeck the option

Is there a way to highlight the file I'm currently working on in the vscode explorer sidebar?

I have a lot of files in my root folder, and I'd like to be able to easily pinpoint where the current file is located in the VScode Explorer sidebar.
The "File: Reveal Active File in Side Bar" command is almost what I need: it opens the Explorer sidebar and highlights the current root folder with a blue box. However, the entire root folder is highlighted, not the specific file, so I still have to hunt for it amid all the other subdirectories and files in that tree.
Is there a command or set of commands I could use to achieve this? Alternately, is there a setting I could change that keeps the active file highlighted in the sidebar all the time? I'd just like some sort of indicator to see exactly where in the tree my active file is located.
add in settings.json
"workbench.colorCustomizations": {
"list.inactiveSelectionBackground": "#fffb17",
}
A small tip: in this picture:
please click "1" once, and then click "2" twice.
ctrl+shift+E
try it!
is there a setting I could change that keeps the active file highlighted in the sidebar all the time? I'd just like some sort of indicator to see exactly where in the tree my active file is located.
Was searching for this myself when I discovered the solution.
It sounds like what OP is looking for is Auto Reveal. Open your Settings: File > Preferences > Settings (or for a pc shortcut hold ctrl and press ,) and search for "explorer". Then under Explorer: Auto Reveal, select True or focusNoScroll.
With this option on, when you have multiple files open, each from different folders or projects, clicking on each tab (thereby making it the "active" file, which is what OP wanted) will automatically highlight the file in the Explorer column to the left of the editor.

VSCode file explorer navigation bar?

In RubyMine, PHPStorm (and other JetBrains IDEs I imagine) you can hit ⌘ Command+⬆ (or whatever shortcut defined for the action) and browse the files in a project from the point of where the current opened file is situated, they call it the "Navigation Bar". Is there a feature like this in VSCode that I'm not finding?
In VSCode, Selecting a breadcrumb in the path displays a dropdown with that level's siblings so you can quickly navigate to other folders and files.
https://code.visualstudio.com/docs/editor/editingevolved#_breadcrumbs

Drag and drop/creating new folder in project root folder in Visual Studio Code

I've opened a folder in VS Code and I wish to create a subfolder using the buttons that appear alongside the folder name in the sidebar or by using the right click context menu.
When using either of those options, it creates a folder in one of the subfolders instead, not the initial folder I opened.
The only way I can make it create a folder in the project root is by selecting the 'empty space' in the sidebar and then pressing the create folder button. The problem with this is that if there are many items in the sidebar then there is no empty space to click on.
Have I completely overlooked something trivial here?
E.g. In the .gif I want to create a new folder under the folder named + (plus sign - sorry for weird folder name)
EDIT: Have updated the title to mention another related issue with drag and drop to the root folder using the sidebar when the root folder has no files in it or if there is no empty space in the sidebar.
Also, here's a partial solution/workaround for creating a new file/folder in root folder using sidebar:
Select any folder in the sidebar and press ESC twice until a border appears around the sidebar, you can then create a file/folder and it will appear in the root. Only a partial solution because it doesn't help with the drag/drop to root folder issue that I've recently noticed.
I had the same problem,too,now it's solved.
Click the blank space of the project folder below all existing folders,then you'll find one blue border around the sidebar,click new foler button,it will be created in the initial folder.
Basically you can select any file in root and then press on add new button it will add new directory on same level as root file, in root :)
The answer from #morris S above works really well. Select any folder in the sidebar and press esc twice until you see a blue outline around the entire side bar then select the new folder icon and you will have a new folder in the root directory.

Zend Studio for Eclispse Expand All feature

is there a way to select a folder and somehow expand all the child folders of the selected folder? It would be very useful.
The issue that I imagine is that because in Zend Studio php files are expandable also so they can show their classes namespaces methods and etc if there is a way to expand a folder and all its subfolders it shouldn't expand php files too.
Thanks in advance :)
In the project view, this feature does not exists.
However, you can right click on your top folder then click "search". This will open a search window. Simply press the "search" button without any search field entered and another window will appear with the results. In this window, you have a small "expand all" button in the top corner.
You can also right click on your top folder in that window and the "expand all" option will be displayed there too.