-
Notifications
You must be signed in to change notification settings - Fork 5
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 tree view drag and drop. #61
Conversation
Here's the extension to test: and here's the corresponding source: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes! From testing i have 3 comments/questions:
Minor: The link to the API in the description should be https://code.visualstudio.com/api/references/vscode-api#TreeDragAndDropController<T>
i believe.
Should i be able to drag a local file into the editor frame in the browser variant? (Does not work for me on Ubuntu 20.04)
Should it be possible to drag a TreeItem to the root of the Tree or is this not supported? (This does also not work for me)
Not sure, I'll check: by "root" you mean for example dragging to an empty space at the bottom of the view, right? |
Yes exactly. Thank you for checking! |
The VS Code doc says:
so yes, dragging to an unoccupied area should work. Grr... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes! Looks good and works great!
…ipse-theia#11776 Adds support for contributing drag and drop controller in the tree view plugin API Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
5da9fe6
to
6789039
Compare
Opened eclipse-theia#11778 |
Signed-off-by: Thomas Mäder t.s.maeder@gmail.com
What it does
Adds support for contributing drag and drop controller in the tree view plugin API. The code tries to mimick the behaviour described in https://code.visualstudio.com/api/references/vscode-api#TreeDragAndDropController<T> as well as possible. I have also refactored some of the "drag into editor area" code to work with the new code (and fixed dragging external files into electron on windows as a "drive-by")
Contributed on behalf of ST Microelectronics
Fixes eclipse-theia#11778, Fixes eclipse-theia#11776
How to test
I have adapted the VS Code tree view sample to exercise the code added in the PR. The extension & source is attached to this PR.
The extension contributes a view called "Test View Drag and Drop", which you need to open.
The example implement multiple features:
The dropped element should be moved under the element where it was dropped.
Note that there seems to be a bug in our tree-view refresh code where the UI goes into an endless loop when you reparent the elements of the tree: It seems the parent field of the tree items is not properly updated when an item is reparented. I am pretty convinced this is not related to the changes in this PR.
This should open a *.js file from the extension itself: note that the cursor will be placed at line 10, column 6.
Review checklist
Reminder for reviewers