Skip to content

Fix dragging a folder from the explorer tree to terminal no longer copies folder path#128419

Merged
meganrogge merged 5 commits intomicrosoft:mainfrom
jeanp413:fix-128283
Jul 26, 2021
Merged

Fix dragging a folder from the explorer tree to terminal no longer copies folder path#128419
meganrogge merged 5 commits intomicrosoft:mainfrom
jeanp413:fix-128283

Conversation

@jeanp413
Copy link
Contributor

This PR fixes #128283

This is a regression from #125943 as DataTransfers.RESOURCES are now only used for file resources and folders are filtered out when setting this dataTransfer type:

const files = fileSystemResources.filter(({ isDirectory }) => !isDirectory);
if (files.length) {
event.dataTransfer.setData(DataTransfers.RESOURCES, JSON.stringify(files.map(({ resource }) => resource.toString())));
}

Fortunately, there is CodeDataTransfers.FILES containing files and folders so I'm adding that as a valid dnd type for the terminal

const fileResources = items.filter(s => s.resource.scheme === Schemas.file).map(r => r.resource.fsPath);
if (fileResources.length) {
originalEvent.dataTransfer.setData(CodeDataTransfers.FILES, JSON.stringify(fileResources));
}

@Tyriar Tyriar added this to the August 2021 milestone Jul 26, 2021
@meganrogge meganrogge modified the milestones: August 2021, July 2021 Jul 26, 2021
@meganrogge
Copy link
Collaborator

Thank you! Works great 👍🏼

@meganrogge meganrogge merged commit c093b78 into microsoft:main Jul 26, 2021
@jeanp413 jeanp413 deleted the fix-128283 branch July 26, 2021 18:04
@gregvanl gregvanl changed the title Fix dragging a folder from the the explorer tree to terminal no longer copies folder path Fix dragging a folder from the explorer tree to terminal no longer copies folder path Jul 31, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dragging a folder from the the explorer tree to terminal no longer copies folder path

4 participants