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

Support to drag and drop selected text #1046

Closed
curtw opened this issue Dec 6, 2015 · 88 comments · Fixed by #20565
Closed

Support to drag and drop selected text #1046

curtw opened this issue Dec 6, 2015 · 88 comments · Fixed by #20565
Assignees
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Milestone

Comments

@curtw
Copy link

curtw commented Dec 6, 2015

In Microsoft Visual Studio Professional you can click+hold on selected text and then drag that text to a new location. Like a cut/paste operation by dragging/dropping. Requesting that VS Code support this feature. Thanks!

@egamma egamma added the feature-request Request for new features or functionality label Dec 7, 2015
@curtw curtw changed the title click+hold to drag/drop selected test click+hold to drag/drop selected text Dec 9, 2015
@egamma egamma modified the milestone: Backlog Dec 10, 2015
@ghost
Copy link

ghost commented Dec 20, 2015

👍 Except I think you don't have to hold ctrl just to cut/paste - ctrl once dragging makes it copy instead of cut, right? But regular drag gets rid of the original, moves it to the new location.

@Nimzozo
Copy link

Nimzozo commented Mar 4, 2016

👍 +1
Agree with @MrAndMrsK .

@senjacob
Copy link

https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/9492333-drag-and-drop-of-selected-text

@pawchen
Copy link

pawchen commented Apr 30, 2016

+1, commenting to get notification. Really miss that.

@Spown
Copy link

Spown commented May 11, 2016

@senjacob https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7763958-drag-n-drop-selections

@benignant
Copy link

Agreed.

@sheltonjb
Copy link

NEEEEED! I use this constantly! feels alien without it and so long winded..

@Bungalow12
Copy link

+1 this is a must have

@wmjordan
Copy link

wmjordan commented Jun 21, 2016

It took more than one year for them to implement this feature.......

@Spown
Copy link

Spown commented Jun 21, 2016

@wmjordan how much did you pay for VSCode?

@NValerij
Copy link

@Spown sorry for duplicate. Deleted.

@apmckinlay
Copy link

+1

@alexdima alexdima self-assigned this Aug 9, 2016
@tsaltd
Copy link

tsaltd commented Aug 11, 2016

no comments re: being able to drop a library item from the directory tree into a view to set the path for css / js etc libraries --- a la Visual Studio

@alexdima alexdima added editor-core Editor basic functionality editor labels Aug 16, 2016
@reactivize
Copy link

What's the technical holdback on drag and drop of selected text?

@Spown
Copy link

Spown commented Aug 18, 2016

@reactivize I don't think its technical. I think nobody on the dev team thinks its worth spending time onto because nobody of them uses this coding style. VSCode was meant to be used without taking your hands away from the keyboard, hence no button palettes, a textual command palette, no miniwindows, etc.

They already kinda separated Monaco editor from the core so maybe it would be possible in the future to plug in a different editor, like Ace (however I don't think so, since hardly any of the available editors offer debugger support, ie breakpoints) that already supports D&D. But a standardized interface between core and wrapped editor is needed for that and this can be even more difficult to implement.

@alexdima
Copy link
Member

@reactivize There is no technical holdback, each milestone we pick features from the backlog to implement. We use thumbs up counts and comment counts as metrics to determine the community desire for a certain feature and then we use our best judgement (effort vs rewards, short-term vs long-term benefits) to pick what to work on.

@miquelfire
Copy link

Starting up some development, decided to use this tool because of the debugger, and this was really annoying to find missing.

@giddyupgrp
Copy link

Adding both my thumbs up to the request for this feature. Its driving me crazy that its not there.

@SynCap
Copy link

SynCap commented Aug 27, 2016

Must have!!!
Especially dragging text between docs, editors, drag text to another apps, such as browser, and vice versa.

@Luffyyy
Copy link

Luffyyy commented Aug 29, 2016

A feature that is in visual studio obviously should be in visual studio code as well.

@alexdima alexdima modified the milestones: February 2017, Backlog Feb 21, 2017
@rebornix rebornix mentioned this issue Feb 21, 2017
2 tasks
@rebornix
Copy link
Member

@rotan-hanrahan thank you very much, you helped me create a thorough test plan for this feature :)

@apazureck
Copy link

Would it be a problem to have a drop-handler in the extension api?

I am thinking of a feature of dropping images on markdown code and - like here on github - getting the image uploaded (in this case added to a project).

@Kureev
Copy link

Kureev commented Feb 27, 2017

I second that ^. Would be great to see API hooks for workspace drop events.

Usage example: If you render a list of components / plugins / whatever in the second tab (as a read-only HTML), you can drag and drop them to the workspace then. I'll be happy to collaborate on this feature if needed.

@iredwards
Copy link

Thank you x 10,000 to @rebornix and everyone who contributed to this. I'm enjoying this now in 1.10.0, and life is more pleasant now! This feature makes a big difference for me and I'm truly delighted. I worked for 12 years at MS long ago, including several in the Visual Studio and other Dev Div product groups. I've never been so happy to see a few feature ship, seriously. Thanks again!

@wmjordan
Copy link

wmjordan commented Mar 2, 2017

Thank you @rebornix very much.
I am using VS Code now.

@langdonx
Copy link

langdonx commented Mar 3, 2017

Great start, thanks for adding this! Some notes for polish on the final product (not sure if there's a better place to put these):

  • The mouse cursor should change to the default arrow when you hover over a selection that can be dragged and while dragging it.
  • A user should not be able to drag a selection into itself (technically you can't, but the mouse cursor and target cursor both lead you to believe you can).
  • A user should be able to hold CTRL (or whatever in other operating systems) to copy the selection instead of move it.

Visual Studio and most editors with drag/drop support do these things if you need an example.

Thanks again!!

@devuxer
Copy link

devuxer commented Mar 3, 2017

I second @langdonx suggestions, particularly the one about using CTRL+drag to copy.

@martinsuchan
Copy link

martinsuchan commented Mar 3, 2017

@langdonx @rebornix For MVP it's a great start, but it needs some finer tuning, for instance

  • dragging selected text between left and right tab
  • dragging selected text between VS Code and other app, in both ways, just like it works in a browser.
  • dragging in column selection mode
  • pressing Esc when dragging should cancel the event altogether. Now after pressing Esc you can start typing, but the text is dropped once you release the mouse anyway.

@rotan-hanrahan
Copy link

I mentioned previously some of the failing test cases that have been raised since the preview of the @rebornix D&D support was released. This D&D feature enhancement, limited as it is, is still a massive improvement over having no D&D support at all. I would like to point out that the "drag to top/bottom of window to cause scrolling" appears to work despite the (closed) test cases documentation #21012 stating that this functionality is not supported. Seems we got lucky with this one.

As people seem to be contributing to the shopping list of must-haves, let me add this proposal: drag selected text over the title tab of an open file in VSC (other than the current file in which the text is selected) so that the hovered-over tab becomes the active document, allowing the user to drag text between files. This would be a bit like the way that tabs in the Windows task bar can activate the corresponding window/application as a drop target when you hover over the tab while dragging. (And please note that this isn't a must-have, but it will be pleasant to see working some day.)

@dvader
Copy link

dvader commented Mar 8, 2017

Not knowing where to comment on the feature, I am adding it here.
Regarding the comment from @langdonx:

  • The mouse cursor should change to the default arrow when you hover over a selection that can be dragged and while dragging it.

Looking at other programs, the cursors actually look like so:

  1. Hover (as in the comment): arrow over
  2. Move: move arrow
  3. Copy (holding the Ctrl key): copy arrow

@Daivuk
Copy link

Daivuk commented Mar 8, 2017 via email

@rebornix
Copy link
Member

rebornix commented Mar 8, 2017

@dvader the mouse pointer style update is coming in tomorrow's Insider

DND

default

DND with Alt/Ctrl Key pressed

copy

@Daivuk you should be able to copy instead of just cutting.

@Daivuk
Copy link

Daivuk commented Mar 8, 2017 via email

@rv-rsouza
Copy link

When is this coming to OSX?

@martinsuchan
Copy link

@rebornix is there a plan to use the standard Windows drag cursors that @dvader shown above? The green Copy cursor looks a bit strange.

@wellenzhong
Copy link

This is now supported as of Feb 2017 release (1.10.1) but it is disabled by default.

To enable it: Go to File > Preferences > Settings and add this line "editor.dragAndDrop": true

Source: https://code.visualstudio.com/updates/v1_10#_preview-drag-and-drop-selected-text

@langdonx
Copy link

langdonx commented Apr 6, 2017

Happy to see the continual progress on this. Just got the March release and noticed one minor (but annoying) issue:

  • In VS Code, the cursor (with copy indication) only changes on mouse move.
  • In VS 20xx, while dragging text you can press and release CTRL to affect the mouse cursor.

My typical workflow is, 1) select text, 2) drag text, 3) hold control, 4) drop text. With this workflow, since my mouse is still, it's not clear that the text will be copied when I release the mouse.

Thanks for all the hard work!

CC: @rebornix (not sure who else to CC) =[

@rebornix
Copy link
Member

@langdonx it's a valid feature request, do you want to create an issue for me?

@langdonx
Copy link

Cross reference #24547

@wewake4
Copy link

wewake4 commented Apr 20, 2017

Drag and drop is working fine in visual code but the same code is not updated in Monaco editor ?
Monaco Editor
When it will be avialable ?

@DRSDavidSoft
Copy link

Wow, It's amazing that this feature has been already implemented into VS Code!
Question: Could you feature the comment as a solution for future visitors?

#1046 (comment)

@rebornix
Copy link
Member

@DRSDavidSoft do you mind tell me how to feature a comment as a solution?

@rebornix
Copy link
Member

@wewake4 we updated Monaco on Mar 3rd, you should be able to have this feature.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.