Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to drop folder(s) into empty files explorer #38746

Closed
user3323 opened this issue Nov 20, 2017 · 6 comments
Closed

Allow to drop folder(s) into empty files explorer #38746

user3323 opened this issue Nov 20, 2017 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues on-testplan release-notes Release notes issues
Milestone

Comments

@user3323
Copy link

  • VSCode Version: 1.19.0-ins
  • OS Version: win7x64

When the workspace is empty - drag'n'drop doesn't work.

workspace empty - adding folder

@vscodebot vscodebot bot added the editor label Nov 20, 2017
@bpasero bpasero added feature-request Request for new features or functionality file-explorer Explorer widget issues and removed editor labels Nov 20, 2017
@bpasero bpasero changed the title Drag'n'Drop doesn't work when workspace is empty Allow to drop folder(s) into empty files explorer Nov 20, 2017
@isidorn isidorn added this to the On Deck milestone Nov 22, 2017
@isidorn
Copy link
Contributor

isidorn commented Jun 5, 2018

@bpasero I was looking into implementing this and wanted to check when is the window reload necessery now? Is it ever needed? When going from purple vscode to workspace is it needed?
I think it is needed because the current open dialog always reloads, and if that is the case I would need to reload here also on drop. Should I just trigger a reload after I add a folder to the workspace or is there more?

Strangely I get a method not implemented error If I doing everything without a reload

  ERR Method not implemented.: Error: Method not implemented.
    at MainThreadComments.dispose (file:///Users/isidor/Development/vscode/out/vs/workbench/api/electron-browser/mainThreadComments.js:139:19)
    at ExtensionHostProcessManager.dispose (file:///Users/isidor/Development/vscode/out/vs/workbench/services/extensions/electron-browser/extensionService.js:145:30)
    at ExtensionService._stopExtensionHostProcess (file:///Users/isidor/Development/vscode/out/vs/workbench/services/extensions/electron-browser/extensionService.js:287:55)
    at ExtensionService.stopExtensionHost (file:///Users/isidor/Development/vscode/out/vs/workbench/services/extensions/electron-browser/extensionService.js:282:18)
    at WorkspaceEditingService.doEnterWorkspace (file:///Users/isidor/Development/vscode/out/vs/workbench/services/workspace/node/workspaceEditingService.js:150:35)
    at WorkspaceEditingService.createAndEnterWorkspace (file:///Users/isidor/Development/vscode/out/vs/workbench/services/workspace/node/workspaceEditingService.js:114:25)
    at WorkspaceEditingService.doAddFolders (file:///Users/isidor/Development/vscode/out/vs/workbench/services/workspace/node/workspaceEditingService.js:87:29)
    at WorkspaceEditingService.addFolders (file:///Users/isidor/Development/vscode/out/vs/workbench/services/workspace/node/workspaceEditingService.js:72:25)
    at HTMLDivElement.<anonymous> (file:///Users/isidor/Development/vscode/out/vs/workbench/parts/files/electron-browser/views/emptyView.js:71:47)

@bpasero
Copy link
Member

bpasero commented Jun 5, 2018

@isidorn that error seems to be from the recently pushed changes for PR reviews (@rebornix). A window reload is not needed if the dropped folders form a new untitled workspace, however not sure we want to do that all the time. E.g. if you drop just one folder, it would make sense to me that the window reloads to open that folder. If multiple folders are dropped, then we can transition into an untitled workspace. I think that code already exists when you drop folder(s) into the explorer.

@isidorn isidorn closed this as completed in 81621d9 Jun 5, 2018
@isidorn
Copy link
Contributor

isidorn commented Jun 5, 2018

@bpasero thanks, however there is no code that does this afaik. Since in the explorer we are always at least in one folder so we always go to a workspace when adding.
I agree that the behavior would be better if only one file is dropped that it is not opened in the workspace. What is the API to do this? Could not find it since there are too many variations of workspace mutation commands

@rebornix do you need a seperate issue for the bug mentioned here?

@rebornix
Copy link
Member

rebornix commented Jun 5, 2018

@isidorn thanks, I'll fix the exception real quick.

rebornix added a commit that referenced this issue Jun 5, 2018
@bpasero
Copy link
Member

bpasero commented Jun 6, 2018

@isidorn IWindowService.openWindow() probably with the forceReuseWindow option set to true.

Btw there is a helper method to handle the drop of files or folders here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/browser/dnd.ts#L172. If you use that one, it automatically takes care of:

  • opening 1 folder if its just one
  • creating a workspace for multiple folders
  • opening a workspace if the dropped file is a workspace

@isidorn isidorn modified the milestones: On Deck, June 2018 Jun 6, 2018
@isidorn
Copy link
Contributor

isidorn commented Jun 6, 2018

@bpasero thanks, this simplifies things a lot, was not aware of that helper class.

isidorn added a commit that referenced this issue Jun 6, 2018
@isidorn isidorn added the release-notes Release notes issues label Jun 28, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues on-testplan release-notes Release notes issues
Projects
None yet
Development

No branches or pull requests

4 participants