Skip to content

Commit c8914e2

Browse files
committed
Add log for dragMimeTypes
Fixes microsoft#145907
1 parent 07cdd7e commit c8914e2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/vs/workbench/browser/parts/views/treeView.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,14 +1283,31 @@ export class CustomTreeViewDragAndDrop implements ITreeDragAndDrop<ITreeItem> {
12831283
this.dndController = controller;
12841284
}
12851285

1286+
private handleDragAndLog(dndController: ITreeViewDragAndDropController, itemHandles: string[], uuid: string, dragCancellationToken: CancellationToken): Promise<IDataTransfer | undefined> {
1287+
return dndController.handleDrag(itemHandles, uuid, dragCancellationToken).then(additionalDataTransfer => {
1288+
if (additionalDataTransfer) {
1289+
const unlistedTypes: string[] = [];
1290+
for (const item of additionalDataTransfer.entries()) {
1291+
if ((item[0] !== this.treeMimeType) && (dndController.dragMimeTypes.findIndex(value => value === item[0]) < 0)) {
1292+
unlistedTypes.push(item[0]);
1293+
}
1294+
}
1295+
if (unlistedTypes.length) {
1296+
this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${unlistedTypes.join(', ')}`);
1297+
}
1298+
}
1299+
return additionalDataTransfer;
1300+
});
1301+
}
1302+
12861303
private addExtensionProvidedTransferTypes(originalEvent: DragEvent, itemHandles: string[]) {
12871304
if (!originalEvent.dataTransfer || !this.dndController) {
12881305
return;
12891306
}
12901307
const uuid = generateUuid();
12911308

12921309
this.dragCancellationToken = new CancellationTokenSource();
1293-
this.treeViewsDragAndDropService.addDragOperationTransfer(uuid, this.dndController.handleDrag(itemHandles, uuid, this.dragCancellationToken.token));
1310+
this.treeViewsDragAndDropService.addDragOperationTransfer(uuid, this.handleDragAndLog(this.dndController, itemHandles, uuid, this.dragCancellationToken.token));
12941311
this.treeItemsTransfer.setData([new DraggedTreeItemsIdentifier(uuid)], DraggedTreeItemsIdentifier.prototype);
12951312
if (this.dndController.dragMimeTypes.find((element) => element === Mimes.uriList)) {
12961313
// Add the type that the editor knows

0 commit comments

Comments
 (0)