Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/vs/workbench/browser/parts/editor/editorActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,6 @@ export class ToggleGroupSizesAction extends Action2 {
}
}


export class MaximizeGroupHideSidebarAction extends Action2 {

constructor() {
Expand Down
17 changes: 9 additions & 8 deletions src/vs/workbench/browser/parts/editor/editorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
this.gridWidget.resizeView(groupView, size);
}

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

const groupView = this.assertGroupView(target);

switch (arrangement) {
case GroupsArrangement.EVEN:
this.gridWidget.distributeViewSizes();
Expand All @@ -392,24 +394,24 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
if (this.groups.length < 2) {
return; // need at least 2 groups to be maximized
}
this.gridWidget.maximizeView(target);
target.focus();
this.gridWidget.maximizeView(groupView);
groupView.focus();
break;
case GroupsArrangement.EXPAND:
this.gridWidget.expandView(target);
this.gridWidget.expandView(groupView);
break;
}
}

toggleMaximizeGroup(target: IEditorGroupView = this.activeGroup): void {
toggleMaximizeGroup(target: IEditorGroupView | GroupIdentifier = this.activeGroup): void {
if (this.hasMaximizedGroup()) {
this.unmaximizeGroup();
} else {
this.arrangeGroups(GroupsArrangement.MAXIMIZE, target);
}
}

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

private unmaximizeGroup(): void {
this.gridWidget.exitMaximizedView();
// When making views visible the focus can be affected, so restore it
this._activeGroup.focus();
this._activeGroup.focus(); // When making views visible the focus can be affected, so restore it
}

private hasMaximizedGroup(): boolean {
Expand Down
17 changes: 12 additions & 5 deletions src/vs/workbench/browser/parts/editor/editorParts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IAuxiliaryWindowOpenOptions, IAuxiliaryWindowService } from 'vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService';
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle';
import { distinct } from 'vs/base/common/arrays';

export class EditorParts extends Disposable implements IEditorGroupsService, IEditorPartsView {

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

getGroups(order = GroupsOrder.CREATION_TIME): IEditorGroupView[] {
if (this._parts.size > 1) {
// TODO@bpasero support non-creation-time group orders across parts
return [...this._parts].map(part => part.getGroups(order)).flat();
let parts: EditorPart[];
if (order === GroupsOrder.MOST_RECENTLY_ACTIVE) {
parts = distinct([this.activePart, ...this._parts]); // put active part first in this order
} else {
parts = this.parts;
}

return parts.map(part => part.getGroups(order)).flat();
}

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

arrangeGroups(arrangement: GroupsArrangement, group?: IEditorGroupView): void {
arrangeGroups(arrangement: GroupsArrangement, group?: IEditorGroupView | GroupIdentifier): void {
(group !== undefined ? this.getPart(group) : this.activePart).arrangeGroups(arrangement, group);
}

toggleMaximizeGroup(group?: IEditorGroupView): void {
toggleMaximizeGroup(group?: IEditorGroupView | GroupIdentifier): void {
(group !== undefined ? this.getPart(group) : this.activePart).toggleMaximizeGroup(group);
}

toggleExpandGroup(group?: IEditorGroupView): void {
toggleExpandGroup(group?: IEditorGroupView | GroupIdentifier): void {
(group !== undefined ? this.getPart(group) : this.activePart).toggleExpandGroup(group);
}

Expand Down