Update tree drag and drop sample

This commit is contained in:
Alex Ross
2022-01-19 13:28:21 +01:00
parent 1c7938db65
commit 799d4ab249
2 changed files with 4 additions and 7 deletions

View File

@ -91,10 +91,8 @@ export class TestViewDragAndDrop implements vscode.TreeDataProvider<Node>, vscod
}
}
public async handleDrag(source: Node[]): Promise<vscode.TreeDataTransfer> {
const dataTransfer = new vscode.TreeDataTransfer<TestViewObjectTransferItem>();
dataTransfer.set('text/treeitems', new TestViewObjectTransferItem(source));
return dataTransfer;
public async handleDrag(source: Node[], treeDataTransfer: vscode.TreeDataTransfer): Promise<void> {
treeDataTransfer.set('text/treeitems', new TestViewObjectTransferItem(source));
}
// Helper methods

View File

@ -102,11 +102,10 @@ declare module 'vscode' {
* When the items are dropped on **another tree item** in **the same tree**, your `TreeDataTransferItem` objects
* will be preserved. See the documentation for `TreeDataTransferItem` for how best to take advantage of this.
*
* The returned `TreeDataTransfer` will be merged with the original`TreeDataTransfer` for the operation.
*
* @param source The source items for the drag and drop operation.
* @param treeDataTransfer The data transfer associated with this drag.
*/
handleDrag?(source: T[]): Thenable<TreeDataTransfer>;
handleDrag?(source: T[], treeDataTransfer: TreeDataTransfer): Thenable<void> | void;
/**
* Called when a drag and drop action results in a drop on the tree that this `DragAndDropController` belongs too.