Skip to content

Commit 904c88e

Browse files
authored
Open view container on drop if it is the only visible one (microsoft#196585)
microsoft#196359 Open view container on drop if it is the only visible one
1 parent ac34230 commit 904c88e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/vs/workbench/browser/parts/activitybar/activitybarPart.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
208208
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
209209
@IConfigurationService private readonly configurationService: IConfigurationService,
210210
@IMenuService private readonly menuService: IMenuService,
211-
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
211+
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
212212
) {
213213
super({
214214
...options,
215215
fillExtraContextMenuActions: (actions, e) => {
216216
options.fillExtraContextMenuActions(actions, e);
217217
this.fillContextMenuActions(actions, e);
218218
}
219-
}, part, paneCompositePart, instantiationService, storageService, extensionService, viewDescriptorService, contextKeyService, environmentService);
219+
}, part, paneCompositePart, instantiationService, storageService, extensionService, viewDescriptorService, contextKeyService, environmentService, layoutService);
220220

221221
if (showGlobalActivities) {
222222
this.globalCompositeBar = this._register(instantiationService.createInstance(GlobalCompositeBar, () => this.getContextMenuActions(), (theme: IColorTheme) => this.options.colors(theme), this.options.activityHoverOptions));

src/vs/workbench/browser/parts/paneCompositeBar.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export class PaneCompositeBar extends Disposable {
106106
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
107107
@IContextKeyService protected readonly contextKeyService: IContextKeyService,
108108
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
109+
@IWorkbenchLayoutService protected readonly layoutService: IWorkbenchLayoutService,
109110
) {
110111
super();
111112
this.location = paneCompositePart.partId === Parts.PANEL_PART
@@ -208,6 +209,12 @@ export class PaneCompositeBar extends Disposable {
208209

209210
if (to === this.location) {
210211
this.onDidRegisterViewContainers([container]);
212+
213+
// Open view container if part is visible and there is no other view container opened
214+
const visibleComposites = this.compositeBar.getVisibleComposites();
215+
if (!this.paneCompositePart.getActivePaneComposite() && this.layoutService.isVisible(this.paneCompositePart.partId) && visibleComposites.length) {
216+
this.paneCompositePart.openPaneComposite(visibleComposites[0].id);
217+
}
211218
}
212219
}
213220

0 commit comments

Comments
 (0)