Skip to content

Commit d6f9e21

Browse files
authored
aux window 💄 (#198433)
1 parent efe5bee commit d6f9e21

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,6 @@ export class ToggleGroupSizesAction extends Action2 {
10871087
}
10881088
}
10891089

1090-
10911090
export class MaximizeGroupHideSidebarAction extends Action2 {
10921091

10931092
constructor() {

src/vs/workbench/browser/parts/editor/editorPart.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
375375
this.gridWidget.resizeView(groupView, size);
376376
}
377377

378-
arrangeGroups(arrangement: GroupsArrangement, target = this.activeGroup): void {
378+
arrangeGroups(arrangement: GroupsArrangement, target: IEditorGroupView | GroupIdentifier = this.activeGroup): void {
379379
if (this.count < 2) {
380380
return; // require at least 2 groups to show
381381
}
@@ -384,6 +384,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
384384
return; // we have not been created yet
385385
}
386386

387+
const groupView = this.assertGroupView(target);
388+
387389
switch (arrangement) {
388390
case GroupsArrangement.EVEN:
389391
this.gridWidget.distributeViewSizes();
@@ -392,24 +394,24 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
392394
if (this.groups.length < 2) {
393395
return; // need at least 2 groups to be maximized
394396
}
395-
this.gridWidget.maximizeView(target);
396-
target.focus();
397+
this.gridWidget.maximizeView(groupView);
398+
groupView.focus();
397399
break;
398400
case GroupsArrangement.EXPAND:
399-
this.gridWidget.expandView(target);
401+
this.gridWidget.expandView(groupView);
400402
break;
401403
}
402404
}
403405

404-
toggleMaximizeGroup(target: IEditorGroupView = this.activeGroup): void {
406+
toggleMaximizeGroup(target: IEditorGroupView | GroupIdentifier = this.activeGroup): void {
405407
if (this.hasMaximizedGroup()) {
406408
this.unmaximizeGroup();
407409
} else {
408410
this.arrangeGroups(GroupsArrangement.MAXIMIZE, target);
409411
}
410412
}
411413

412-
toggleExpandGroup(target: IEditorGroupView = this.activeGroup): void {
414+
toggleExpandGroup(target: IEditorGroupView | GroupIdentifier = this.activeGroup): void {
413415
if (this.isGroupExpanded(this.activeGroup)) {
414416
this.arrangeGroups(GroupsArrangement.EVEN);
415417
} else {
@@ -419,8 +421,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
419421

420422
private unmaximizeGroup(): void {
421423
this.gridWidget.exitMaximizedView();
422-
// When making views visible the focus can be affected, so restore it
423-
this._activeGroup.focus();
424+
this._activeGroup.focus(); // When making views visible the focus can be affected, so restore it
424425
}
425426

426427
private hasMaximizedGroup(): boolean {

src/vs/workbench/browser/parts/editor/editorParts.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
1616
import { IAuxiliaryWindowOpenOptions, IAuxiliaryWindowService } from 'vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService';
1717
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
1818
import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle';
19+
import { distinct } from 'vs/base/common/arrays';
1920

2021
export class EditorParts extends Disposable implements IEditorGroupsService, IEditorPartsView {
2122

@@ -228,8 +229,14 @@ export class EditorParts extends Disposable implements IEditorGroupsService, IEd
228229

229230
getGroups(order = GroupsOrder.CREATION_TIME): IEditorGroupView[] {
230231
if (this._parts.size > 1) {
231-
// TODO@bpasero support non-creation-time group orders across parts
232-
return [...this._parts].map(part => part.getGroups(order)).flat();
232+
let parts: EditorPart[];
233+
if (order === GroupsOrder.MOST_RECENTLY_ACTIVE) {
234+
parts = distinct([this.activePart, ...this._parts]); // put active part first in this order
235+
} else {
236+
parts = this.parts;
237+
}
238+
239+
return parts.map(part => part.getGroups(order)).flat();
233240
}
234241

235242
return this.mainPart.getGroups(order);
@@ -260,15 +267,15 @@ export class EditorParts extends Disposable implements IEditorGroupsService, IEd
260267
this.getPart(group).setSize(group, size);
261268
}
262269

263-
arrangeGroups(arrangement: GroupsArrangement, group?: IEditorGroupView): void {
270+
arrangeGroups(arrangement: GroupsArrangement, group?: IEditorGroupView | GroupIdentifier): void {
264271
(group !== undefined ? this.getPart(group) : this.activePart).arrangeGroups(arrangement, group);
265272
}
266273

267-
toggleMaximizeGroup(group?: IEditorGroupView): void {
274+
toggleMaximizeGroup(group?: IEditorGroupView | GroupIdentifier): void {
268275
(group !== undefined ? this.getPart(group) : this.activePart).toggleMaximizeGroup(group);
269276
}
270277

271-
toggleExpandGroup(group?: IEditorGroupView): void {
278+
toggleExpandGroup(group?: IEditorGroupView | GroupIdentifier): void {
272279
(group !== undefined ? this.getPart(group) : this.activePart).toggleExpandGroup(group);
273280
}
274281

0 commit comments

Comments
 (0)