Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Cannot create new file in the project root once you create new files in a folder. #9341

Closed
RaymondLim opened this issue Sep 27, 2014 · 8 comments

Comments

@RaymondLim
Copy link
Contributor

  1. Create a new project.
  2. Right click in the file tree and select New Folder. Accept the default name.
  3. Right click in the blank space and create another folder with the default name.
  4. Right click in the first folder and create a new file with the default name.
  5. Right click in the blank space below the second folder and try to create a new file or folder.

Result: the new file/folder is created inside the first folder created in step 2.

@dangoor
Copy link
Contributor

dangoor commented Sep 29, 2014

This exact same behavior occurs in Release 0.43. The reason this happens is that ProjectManager.getSelectedItem returns:

  • the context (if there is one)
  • the tree selection (if there is one)
  • the currently viewed file

So, it falls through to the third case and creates a file next to the one you're viewing.

I think we should change this, but it would represent a change to the API. I realize that the above already represents a change to the API because the idea of a "context" item did not exist before.

My suggestion is that the third case should be to default to the project directory rather than the currently viewed file. If you're right clicking in the open area in the tree, that seems like a reasonable default behavior.

What do you think, @peterflynn?

@dangoor
Copy link
Contributor

dangoor commented Sep 29, 2014

Tentatively leaving the release 0.44 marker on this thinking that we may want to make this change, though this issue is not a regression from 0.43.

@dangoor dangoor removed this from the Release 0.44 milestone Sep 30, 2014
@dangoor
Copy link
Contributor

dangoor commented Sep 30, 2014

We reviewed this earlier and decided that it's not a release blocker. The fix is simple and I think a reasonable change to getSelectedItem, though, so I anticipate doing this soon.

@dangoor
Copy link
Contributor

dangoor commented Sep 30, 2014

This turns out to be a bit more complicated and I don't know that we should try to fix this for 0.44.

The issue is that if the Working Set has the focus, then ProjectManager.getSelectedItem should indeed return the currently open file as it does currently. So, when the Working Set has focus, you'd need the opening of the context menu to shift focus over to the file tree.

I have a branch which implements this behavior change and makes opening the context menu on the file tree shift focus there. I'm not fully happy with how that works now because it can leave you in a "nothing has the selection bar" state.

@dangoor
Copy link
Contributor

dangoor commented Oct 13, 2014

De-assigning myself because I'm not actively working on this now.

@bobiblazeski
Copy link

Any update on this ? It's annoying for both files and folder. Though with folders you have workaround by opening the lowest folder first, for root files there is no solution.

@matpag
Copy link

matpag commented Aug 19, 2015

Same problem for me while trying to create a new file in the root folder.
Near a year from the report and no fix yet :(

@redmunds
Copy link
Contributor

It's not obvious, but a workaround is to right-click on any file (not folder) in root, then New File and New Folder will create new items in the root.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants
@dangoor @redmunds @JeffryBooher @RaymondLim @bobiblazeski @marcelgerber @matpag and others