Skip to content

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

Merged
Daniel Imms (Tyriar) merged 3 commits into
microsoft:masterfrom
jportela:terminal-paste-path
May 22, 2017
Merged

Daniel Imms (Tyriar) merged 3 commits into
microsoft:masterfrom
jportela:terminal-paste-path

Conversation

@jportela

@jportela João Portela (jportela) commented Apr 18, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown

João Portela (@jportela), thanks for your PR! By analyzing the history of the files in this pull request, we identified Daniel Imms (@Tyriar) and Sandeep Somavarapu (@sandy081) to be potential reviewers.

@msftclas

@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

João Portela (@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

Copy link
Copy Markdown
Contributor

Thanks for this João Portela (@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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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://github.com/Microsoft/vscode/blob/d02567a2e43203f20d4a1daf1ca7c489be033a4b/src/vs/base/common/uri.ts#L215

@jportela

Copy link
Copy Markdown
Contributor Author

Daniel Imms (@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
Copy Markdown
Contributor

João Portela (@jportela) sorry about the delay, bit busy with release stuff atm. I hope to get this in for May 😃

@Tyriar

Copy link
Copy Markdown
Contributor

João Portela (@jportela) sorry about the delay. This is great, thanks a lot 😄 should be included 1.13 🎆

@Tyriar
Daniel Imms (Tyriar) merged commit 8fcea34 into microsoft:master May 22, 2017
@jportela
João Portela (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