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

Inserting file path on the terminal, when dragging a file to it #24951

Merged
merged 3 commits into from
May 22, 2017

Conversation

jportela
Copy link
Contributor

@jportela jportela commented Apr 18, 2017

This feature was suggested in #11907

I've tested the following scenarios, on a MacOS device:

  • Dragging a file from the OS filesystem to the terminal
  • Dragging a file from the tree explorer to the terminal
  • Dragging a tab from the tab panel to the terminal

Let me know if any change is needed

@mention-bot
Copy link

@jportela, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Tyriar and @sandy081 to be potential reviewers.

@msftclas
Copy link

@jportela,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas
Copy link

@jportela, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

@Tyriar Tyriar added this to the April 2017 milestone Apr 18, 2017
@mjbvz mjbvz requested a review from Tyriar April 18, 2017 18:22
@Tyriar Tyriar modified the milestones: May 2017, April 2017 Apr 21, 2017
@Tyriar
Copy link
Member

Tyriar commented Apr 21, 2017

Thanks for this @jportela, just tested out the code and noticed the following (mac):

  • Dropping from Finder results in spaces being retains
  • Dropping from explorer or a VS Code tab results in spaces being encoded to %20
  • Unicode characters are also encoded incorrectly: 中文 -> %E4%B8%AD%E6%96%87

The main actions so far are:

@Tyriar
Copy link
Member

Tyriar commented Apr 21, 2017

Windows seems to work fine, apart from the path needing the to be wrapped in "" when it contains spaces 👍

return;
}
const url = e.dataTransfer.getData('URL');
const filePath = this._getPathFromUrl(url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this you should use Uri.file(path), you should then be able to extract the path in the correct format from that class. https:/Microsoft/vscode/blob/d02567a2e43203f20d4a1daf1ca7c489be033a4b/src/vs/base/common/uri.ts#L215

@jportela
Copy link
Contributor Author

@Tyriar thanks for noticing those cases and showing me the URI utility. I think now they are OK:

screenshot 2017-04-27 23 22 05

@Tyriar
Copy link
Member

Tyriar commented May 2, 2017

@jportela sorry about the delay, bit busy with release stuff atm. I hope to get this in for May 😃

@Tyriar
Copy link
Member

Tyriar commented May 22, 2017

@jportela sorry about the delay. This is great, thanks a lot 😄 should be included 1.13 🎆

@Tyriar Tyriar merged commit 8fcea34 into microsoft:master May 22, 2017
@jportela jportela deleted the terminal-paste-path branch May 23, 2017 14:53
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
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.

4 participants