From f881f8c4229863782a01eae80d70b4d6d540e39d Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 28 Aug 2018 11:27:59 +0200 Subject: [PATCH] explorer: Disable moving workspace roots in one another --- .../electron-browser/views/explorerViewer.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts index 545a6eff66bf7..8612b18ed22d1 100644 --- a/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts @@ -871,15 +871,17 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop { return true; // Can not move anything onto itself } - // If we are not moving workspace root folders - if (!(source.isRoot && target instanceof ExplorerItem && target.isRoot)) { - if (!isCopy && resources.dirname(source.resource).toString() === target.resource.toString()) { - return true; // Can not move a file to the same parent unless we copy - } + if (source.isRoot && target instanceof ExplorerItem && target.isRoot) { + // Disable moving workspace roots in one another + return false; + } - if (resources.isEqualOrParent(target.resource, source.resource, !isLinux /* ignorecase */)) { - return true; // Can not move a parent folder into one of its children - } + if (!isCopy && resources.dirname(source.resource).toString() === target.resource.toString()) { + return true; // Can not move a file to the same parent unless we copy + } + + if (resources.isEqualOrParent(target.resource, source.resource, !isLinux /* ignorecase */)) { + return true; // Can not move a parent folder into one of its children } return false;