Drag and drop/creating new folder in project root folder in Visual Studio Code - 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.

Related

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.

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

How to compare two files in Eclipse?

I want to compare two files. One is in the current project and the other is in the backup directory. I know how to compare if they were in the same project.
How can I compare in Eclipse?
And what is Flex navigator in Eclipse?
Open the Navigator with the Main menu: Window->Show View->Navigator.
You can select two or more files in the Navigator using Ctrl-click, or Command-click in OSX. Now Right-click any one of the selected files, and select the menu item: Compare With->Each Other.
The problem is that your alternate file might not be in the Navigator, e.g. your backup directory isn't listed in the Navigator. If not, Right-click in the Navigator and choose the menu item: New->Folder. In the resulting dialog click the Advanced>> button beneath the Folder Name field, choose Link to alternate location (Linked Folder), and browse to add your backup directory.
Now using the Navigator you'll be able to select the two files, and use Compare With.
You can similarly compare files using e.g. the Package Explorer.

Copy files from search tab in eclipse 3.4

I just want to copy list of files displayed in eclipse search tab,
When i try using right click copy and paste into some folder it does not work.It actually copies the file location rather than the file itself
There is no direct way to do this. What you can do is:
Double click on the entry in the search tab
F12 to switch to the editor
Ctrl+Alt+W to select the file in the navigator view
Drag the file from there to the place where you want it
Too tedious? Then open a command prompt or shell and use the file location there.
If you need file locations then use Eclipse search csv export plugin.
If want to copy the whole file(s) into a folder then refer #Aaron Digulla answer(Its applicable to single file). In case of multiple files. Press Ctrl + A to select all search results in search view. Right click on the selection. Choose Show In > Package Explorer. Drag file(s) to a folder in any file explorer.

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.