diff --git a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts index f1689594e5..019719ed64 100644 --- a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts +++ b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts @@ -56,7 +56,7 @@ export class AsyncServerTreeDragAndDrop implements ITreeDragAndDroporiginalEvent); if (canDragOver.accept) { - return TreeDragOverReactions.acceptBubbleDown(true); + return TreeDragOverReactions.acceptBubbleDown(canDragOver.autoExpand); } else { return { accept: false }; } diff --git a/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts b/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts index 601e30bbfb..1d90f1f4ce 100644 --- a/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts +++ b/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts @@ -157,6 +157,14 @@ export class ServerTreeDragAndDrop implements IDragAndDrop { } if (canDragOver) { + if (targetElement instanceof ConnectionProfile) { + const isConnected = this._connectionManagementService.isProfileConnected(targetElement); + // Don't auto-expand disconnected connections - doing so will try to connect the connection + // when expanded which is not something we want to support currently + return DRAG_OVER_ACCEPT_BUBBLE_DOWN(isConnected); + } + // Auto-expand other elements (groups, tree nodes) so their children can be + // exposed for further dragging return DRAG_OVER_ACCEPT_BUBBLE_DOWN(true); } else { return DRAG_OVER_REJECT;