module.treeViews.add({
id: 'myext.files',
resolveProvider: () => provider,
options: {
dragAndDrop: {
mimeType: 'application/vnd.code.tree.myextfiles',
onDrop(sourceIds, target) {
for (const id of sourceIds) {
const item = provider.findItem(id);
if (item) {
provider.removeItem(id);
provider.addItem(item, target?.id);
}
}
},
},
},
});
Declares drag-and-drop for a tree view.
Handed to
module.treeViews.addasoptions.dragAndDrop; the adapter builds the platform's controller from it. Only ids cross the drag, because ids are what reliably survive its serialisation.