Vscode: Difficult to create folder in left panel file view if the open folder only contains folder

Created on 5 Dec 2015  路  30Comments  路  Source: microsoft/vscode

Open a folder that a lot of folders (enough to fill the height of the screen) and no files, it seems impossible to create a folder or file in the root folder without closing all files in the text view.

feature-request file-explorer on-testplan ux

Most helpful comment

Note that the same issue also applies to Drag and Drop when you try to move a file/folder top level - currently impossible.

I'll copy & paste my solution suggestions from the other issue:

  • [ ] allow dragging files to the project name, which is an always visible UI element
  • [ ] add a slight padding to the bottom of the files list in the Files Explorer, so there is always room to drag files out to the top-level after scrolling down

All 30 comments

Not as simple as it should be, but you can select a file in the root folder and then use the new folder action from the toolbar.

This is specifically about a root folder containing only folders, I imagine it's a pretty common use case to open a folder containing many git repositories but no files.

(closed by accident, sorry)

Thanks for the additional info:

about a root folder that containing only folders

Same applies for a root level file, correct? I had to first select a file in the root directory and then select the New File icon. Otherwise it will use the last selected directory as the context for the new file location.

Note that the same issue also applies to Drag and Drop when you try to move a file/folder top level - currently impossible.

I'll copy & paste my solution suggestions from the other issue:

  • [ ] allow dragging files to the project name, which is an always visible UI element
  • [ ] add a slight padding to the bottom of the files list in the Files Explorer, so there is always room to drag files out to the top-level after scrolling down

It would be nice if there was some way to also drop _between_ folders - currently impossible.

cant-drop

I think the icons could remain when the root folder is collapsed, instead of hiding them. When root is collapsed, the icons pertain to the root.
root

Fixed by always showing the root folder in the explorer when you collapse:

image

We decided against this. You will still be able to show the root folder when you are in multi-root context. More on that later.

If the bottom folder (or the bottom file, if there are files after the folder) could always have that extra bit of margin on the bottom that could be clicked in, that would help. It would still not be entirely intuitive IMO, but may be a simple workaround and would be consistent. I'm guessing that all the background below the root folder is clickable to allow a file to be inserted, but that background can be completely covered by folders. The padding or margin (depending on what its one) would prevent it from being completely covered and inaccessible.

Anyway, I'm a vscode newbie (so I'm not expert in how it works) trying this editor out, and hit this problem almost immediately, so I doubt it's the infrequent edge-case that the description hints it may be.

Any ETA on any of the many solutions proposed in here? As @judgej mentions this is definitely not an infrequent edge case, its a problem that takes away time from the user considering most would give up and just create the folder with some other file manager, resulting in poor user experience.

Someone might find the keybindings I use useful:

// Make the explorer act more like OS file explorer
{ "key": "ctrl+n",          "command": "explorer.newFile", "when": "explorerViewletVisible && filesExplorerFocus" },
{ "key": "cmd+n",           "command": "explorer.newFile", "when": "explorerViewletVisible && filesExplorerFocus" },
{ "key": "ctrl+shift+n",    "command": "explorer.newFolder", "when": "explorerViewletVisible && filesExplorerFocus" },
{ "key": "cmd+shift+n",     "command": "explorer.newFolder", "when": "explorerViewletVisible && filesExplorerFocus" }

With this I can do something like:

  • ctrl+shift+e: focus explorer
  • end: focus last file in root
  • ctrl+n: create a file in the root

It would still be good to improve this but I don't know what that fix is.

I think the problem lies in the fact that it's using the root dir as a "heading" of sorts in the explorer view. I.e. it's a peer of "OPEN EDITORS", with its name in all caps, and distinct from the actual file tree.

If you use File -> Add folder to workspace, the way the tree acts afterwards is perfect. The 2 root dirs are part of the tree. They can be selected to serve as the anchor for the add buttons, and also have a context menu with "New File" and "New Folder". Even if you remove the second one, this behavior persists, having e.g. "UNTITLED (WORKSPACE)" as the explorer heading and the whole tree including the root underneath. Could it just work this way from the start?

3 years down the road this issue is still a major annoyance.

Having to click the vertical scrollbar is not really a solution as I think less than 1% of users would think about such an action. Especially considering that this scrollbar is normally not visible (hidden).

Maybe add 2 context menu items to the name of the root folder? I.e. when you right click the text left of the current buttons for _new file_ and _new folder_?

Being able to drag and drop in between folders would also be a very welcome addition as this action is normally available in other applications with some sort of an explorer panel.

UP! (just add the button "create new folder in selected folder" and "create new folder in project folder" OR right click on PROJECT folder with items "create new file", "create new folder")

This can be remedied with plugins though. I've found this one (ext install create-file-folder) to do the kob well with the default key combo Ctrl + Alt + Shift + N to create a new folder.

Bump! I've been using the "right-click on scrollbar" method to create a root level folder for months now, but with my recent update to 1.28.2 this technique doesn't work anymore because the context menu doesn't come up!

Hilarious how it is still not working. There's no root folder present in my solution.
Imagine this being an issue in 2018 q:^)

I feel like this is workable:

image

@rhys-vdw Cool, never noticed that! :) Yep, that works for me.

@rhys-vdw Hm... spoke too soon. I saw the icons on the top level and I assumed they would create new folders or files on that level. However, they don't - they create folders and files on the level of whatever folder is currently selected in the hierarchy - the same thing I can achieve by using the context menu. So I take back what I said - I still don't see any way of creating a new folder or file on the top level, if the tree list is so full that I can't right-click in empty space anywhere.

Why is it so difficult to not display the opened project as a part of explorer? Just make the root folder appear like a normal folder, so that we are able to click on it and use the context menu. 2018 is coming to an end, and things are still the way they used to be.

My natural inclination is to click on the titlebar, since after all it's titled with the top-level folder name. B But that does not work as expected.
This has been confusing for both us developers and customers. See for instance:

10343

Microsoft/vscode-azurestorage#252
Plus, if the files/folders list takes up all the vertical space, I'm not sure it's possible to get a context menu on the top-level folder at all:

Am i missing a solution for dragging / pasting a root level folder from elsewhere? There was a thread about dragging that was merged here, but this is a different story.

How is this issue from 2015 still not fixed?

Now there are 3 alternatives how to create file/folder top level in a full explorer view:

  1. It is possible to scroll beyond the last element, so you can right click in the empty space
  2. You can press Escape to clear both focus and selection and use the top level actions to achieve this
  3. You can right click on the scroll bar

This is not a definitie solution. We have pushed it to insiders to gather feedback from users and team members. So let us know what you think

explorer

Looks like it's in stable 1.37?

Might have found it via #2, might not have (it requires two presses of ESC), but that is an improvement thanks. Definitely would never find it via the scrollbar.

Personally, I'm not sure it makes sense to have the top-level actions be context-sensitive at all, though. Why not have them add folders/files at the top level all of the time? You can use context menus to create subfolders/subfiles.

@StephenWeatherford changes mentioned in my previous comment are not in stable 1.37. They will be in the next one. But you can try them out in the latest insiders.
As for changing the top level actions thanks for the idea, however changing that would be breaking behavior to what most of our users are used to over the years. So I would definitely be against that.

Wow, 4 years on, I'm glad something is finally being done about this. Even though all of the mentioned fixes are pretty unintuitive and out of place for a friendly tool like VS Code.

Personally, I'm not sure it makes sense to have the top-level actions be context-sensitive at all, though. Why not have them add folders/files at the top level all of the time?

I agree with @StephenWeatherford, and I think this is the general expectation by default. Hopefully we get this in an update soon. I don't think the change in behaviour will be as big a deal as you might think.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisdias picture chrisdias  路  3Comments

trstringer picture trstringer  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

sijad picture sijad  路  3Comments

biij5698 picture biij5698  路  3Comments