From 36c2ee289c5653a81ae587bfe7aca2027f392089 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 26 Jan 2022 17:20:02 -0800 Subject: [PATCH] refs #141426 --- .../browser/actions/layoutActions.ts | 71 +++++++++++++++++-- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 96545124e231f..7b110d1d6aaf0 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -569,14 +569,15 @@ registerAction2(class extends Action2 { viewId = focusedViewId; } - viewId = await this.getView(quickInputService, viewDescriptorService, paneCompositePartService, viewId!); - - if (!viewId) { - return; - } + try { + viewId = await this.getView(quickInputService, viewDescriptorService, paneCompositePartService, viewId!); + if (!viewId) { + return; + } - const moveFocusedViewAction = new MoveFocusedViewAction(); - instantiationService.invokeFunction(accessor => moveFocusedViewAction.run(accessor, viewId)); + const moveFocusedViewAction = new MoveFocusedViewAction(); + instantiationService.invokeFunction(accessor => moveFocusedViewAction.run(accessor, viewId)); + } catch { } } private getViewItems(viewDescriptorService: IViewDescriptorService, paneCompositePartService: IPaneCompositePartService): Array { @@ -630,6 +631,31 @@ registerAction2(class extends Action2 { }); }); + + const sidePanels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.AuxiliaryBar); + sidePanels.forEach(panel => { + const container = viewDescriptorService.getViewContainerById(panel)!; + const containerModel = viewDescriptorService.getViewContainerModel(container); + + let hasAddedView = false; + containerModel.visibleViewDescriptors.forEach(viewDescriptor => { + if (viewDescriptor.canMoveView) { + if (!hasAddedView) { + results.push({ + type: 'separator', + label: localize('sidePanelContainer', "Side Panel / {0}", containerModel.title) + }); + hasAddedView = true; + } + + results.push({ + id: viewDescriptor.id, + label: viewDescriptor.name + }); + } + }); + }); + return results; } @@ -719,6 +745,13 @@ class MoveFocusedViewAction extends Action2 { }); } + if (!(isViewSolo && currentLocation === ViewContainerLocation.AuxiliaryBar)) { + items.push({ + id: '_.auxiliarybar.newcontainer', + label: localize('moveFocusedView.newContainerInSidePanel', "New Side Panel Entry") + }); + } + items.push({ type: 'separator', label: localize('sidebar', "Side Bar") @@ -761,6 +794,27 @@ class MoveFocusedViewAction extends Action2 { }; })); + items.push({ + type: 'separator', + label: localize('sidePanel', "Side Panel") + }); + + const pinnedAuxPanels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.AuxiliaryBar); + items.push(...pinnedAuxPanels + .filter(panel => { + if (panel === viewDescriptorService.getViewContainerByViewId(focusedViewId)!.id) { + return false; + } + + return !viewDescriptorService.getViewContainerById(panel)!.rejectAddedViews; + }) + .map(panel => { + return { + id: panel, + label: viewDescriptorService.getViewContainerModel(viewDescriptorService.getViewContainerById(panel)!)!.title + }; + })); + quickPick.items = items; quickPick.onDidAccept(() => { @@ -772,6 +826,9 @@ class MoveFocusedViewAction extends Action2 { } else if (destination.id === '_.sidebar.newcontainer') { viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.Sidebar); viewsService.openView(focusedViewId, true); + } else if (destination.id === '_.auxiliarybar.newcontainer') { + viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.AuxiliaryBar); + viewsService.openView(focusedViewId, true); } else if (destination.id) { viewDescriptorService.moveViewsToContainer([viewDescriptor], viewDescriptorService.getViewContainerById(destination.id)!); viewsService.openView(focusedViewId, true);