@@ -29,24 +29,13 @@ declare module 'vscode' {
2929 /**
3030 * A class for encapsulating data transferred during a tree drag and drop event.
3131 *
32- * If your `DragAndDropController` implements `handleDrag`, you can extend `TreeDataTransferItem` and return
33- * an instance of your new class for easy access to the source tree items.
34- *
35- * ```ts
36- * class TestViewObjectTransferItem extends vscode.TreeDataTransferItem {
37- * constructor(private _nodes: Node[]) {
38- * super(_nodes);
39- * }
40- *
41- * asObject(): Node[] {
42- * return this._nodes;
43- * }
44- * }
45- * ```
32+ * If your `DragAndDropController` implements `handleDrag`, you can use the `value` of the `TreeDataTransferItem`
33+ * to get back the object you put into it so long as the extension that created the `TreeDataTransferItem` runs in the same
34+ * extension host.
4635 */
4736 export class TreeDataTransferItem {
4837 asString ( ) : Thenable < string > ;
49-
38+ readonly value : any ;
5039 constructor ( value : any ) ;
5140 }
5241
@@ -82,8 +71,8 @@ declare module 'vscode' {
8271 export interface TreeDragAndDropController < T > {
8372
8473 /**
85- * The mime types that the `drop ` method of this `DragAndDropController` supports. This could be well-defined, existing, mime types,
86- * and also mime types defined by the extension that are returned in the `TreeDataTransfer` from `handleDrag` .
74+ * The mime types that the `handleDrop ` method of this `DragAndDropController` supports.
75+ * This could be well- defined, existing, mime types, and also mime types defined by the extension .
8776 *
8877 * Each tree will automatically support drops from it's own `DragAndDropController`. To support drops from other trees,
8978 * you will need to add the mime type of that tree. The mime type of a tree is of the format `tree/treeidlowercase`.
@@ -93,7 +82,13 @@ declare module 'vscode' {
9382 * 2. Use the Developer: Set Log Level... command to set the level to "Debug"
9483 * 3. Open the developer tools and drag the item with unknown mime type over your tree. The mime types will be logged to the developer console
9584 */
96- readonly supportedMimeTypes : string [ ] ;
85+ readonly dropMimeTypes : string [ ] ;
86+
87+ /**
88+ * The mime types that the `handleDrag` method of this `TreeDragAndDropController` may add to the tree data transfer.
89+ * This could be well-defined, existing, mime types, and also mime types defined by the extension.
90+ */
91+ readonly dragMimeTypes : string [ ] ;
9792
9893 /**
9994 * When the user starts dragging items from this `DragAndDropController`, `handleDrag` will be called.
@@ -108,17 +103,20 @@ declare module 'vscode' {
108103 *
109104 * @param source The source items for the drag and drop operation.
110105 * @param treeDataTransfer The data transfer associated with this drag.
106+ * @param token A cancellation token indicating that drag has been cancelled.
111107 */
112- handleDrag ?( source : T [ ] , treeDataTransfer : TreeDataTransfer ) : Thenable < void > | void ;
108+ handleDrag ?( source : T [ ] , treeDataTransfer : TreeDataTransfer , token : CancellationToken ) : Thenable < void > | void ;
113109
114110 /**
115111 * Called when a drag and drop action results in a drop on the tree that this `DragAndDropController` belongs too.
116112 *
117113 * Extensions should fire `TreeDataProvider.onDidChangeTreeData` for any elements that need to be refreshed.
118114 *
119115 * @param source The data transfer items of the source of the drag.
120- * @param target The target tree element that the drop is occuring on.
116+ * @param target The target tree element that the drop is occurring on.
117+ * @param token TODO @alexr00: When would this operation actually be cancelled?
121118 */
122- handleDrop ( source : TreeDataTransfer , target : T ) : Thenable < void > | void ;
119+ // TODO@API align order of TreeDataTransfer and T with handleDrag
120+ handleDrop ( source : TreeDataTransfer , target : T , token : CancellationToken ) : Thenable < void > | void ;
123121 }
124122}
0 commit comments