eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.96k stars 2.5k forks source link

[navigator] don't use ':' as separator in drop event's payload #3650

Open JanKoehnlein opened 5 years ago

JanKoehnlein commented 5 years ago

When dropping a file from the navigator, the drop target resolves the file by looking at event.dataTransfer.get('tree-node'). This yields a string composed of the workspace folder's path, a colon, and the file's path. Using a colon makes it pretty nasty on windows to parse this, as the colon is also used as a drive letter separator in both paths. We should

Maybe there is already such function and I just missed it?

akosyakov commented 5 years ago

tree-node returns a node id, not URI

Let's replace tree-node with tree-data. It should consist of a widget id and node id. Clients can check from which widget drop event is coming by a widget id then and use a node id to retrieve a node from this widget.

westbury commented 5 years ago

Something like this: https://github.com/westbury/theia/tree/GH-3650 ?

The benefits can't be seen in the example Theia build as there is only one file system tree (other than in the file dialogs). However for those of us who have extensions with file system trees, dnd now works between them. Thanks for the suggestion. The regex to parse the id is not that complex but extracting data from an id does seem flaky to me.

BTW, do we really want to allow dnd within the file dialogs?