diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 21d0d2653cf4f11f60c15f2672d5584910bec90d..d8d26f5c7c335d16c663d92fe66172f00b64d820 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -540,15 +540,14 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal } // change part size along the main axis - public resizePart(part: Parts, sizeChange: number): boolean { - let promise = TPromise.as(null); - let doLayout = false; - let newSashSize: number = 0; - let visibleEditors = this.editorService.getVisibleEditors().length; - + public resizePart(part: Parts, sizeChange: number): void { + const visibleEditors = this.editorService.getVisibleEditors().length; const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100); const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100); + let doLayout = false; + let newSashSize: number = 0; + switch (part) { case Parts.SIDEBAR_PART: newSashSize = this.sidebarWidth + sizeChangePxWidth; @@ -572,10 +571,9 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal if (visibleEditorCount === 1) { this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth; doLayout = true; - } - else { - const eGsSM = this.editorGroupService.getStacksModel(); - const activeGroup = eGsSM.positionOfGroup(eGsSM.activeGroup); + } else { + const stacks = this.editorGroupService.getStacksModel(); + const activeGroup = stacks.positionOfGroup(stacks.activeGroup); this.editorGroupService.resizeGroup(activeGroup, sizeChangePxWidth); doLayout = false; @@ -583,11 +581,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal } if (doLayout) { - promise.done(() => this.layout(), errors.onUnexpectedError); + this.layout(); } - - // other parts not resizable, no error just silent - return false; } public dispose(): void { diff --git a/src/vs/workbench/browser/parts/editor/editorGroupsControl.ts b/src/vs/workbench/browser/parts/editor/editorGroupsControl.ts index f8d16cbe0a079c53963e9cd99546cbaadc13a518..c5714c9590e3659314114780274b68061b56b7e4 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupsControl.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupsControl.ts @@ -78,7 +78,7 @@ export interface IEditorGroupsControl { setGroupOrientation(orientation: GroupOrientation): void; getGroupOrientation(): GroupOrientation; - resizeGroup(position: Position, groupSizeChange: number): boolean; + resizeGroup(position: Position, groupSizeChange: number): void; getRatio(): number[]; @@ -847,7 +847,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro } // Resize the editor/group position - changes main axis - public resizeGroup(position: Position, groupSizeChange: number): boolean { + public resizeGroup(position: Position, groupSizeChange: number): void { enum VISIBLE_EDITORS { ONE = 1, @@ -858,10 +858,10 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro const visibleEditors = this.getVisibleEditorCount(); if (visibleEditors <= VISIBLE_EDITORS.ONE) { - return false; + return; } - let availableSize = this.totalSize; + const availableSize = this.totalSize; const activeGroupPosition = this.getActivePosition(); switch (visibleEditors) { @@ -898,9 +898,8 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro default: break; } - this.layout(this.dimension); - return true; + this.layout(this.dimension); } private boundSiloSize(siloPosition: Position, sizeChangePx: number): number { diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index bcd99ba9fe3121bb78a1a2f62602fa7b490cf9a8..90b6db7ec47b386c8a8be43df9fab946d97e650d 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -245,9 +245,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService this._onTabOptionsChanged.fire(this.tabOptions); } - public resizeGroup(position: Position, groupSizeChange: number): boolean { + public resizeGroup(position: Position, groupSizeChange: number): void { this.editorGroupsControl.resizeGroup(position, groupSizeChange); - return true; } public get onEditorsChanged(): Event { diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 776689be8da9de35523bd0db0545436430c85e08..62ea4993ebfafd7fbebe7e5fd3484f1f134c6433 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -1215,21 +1215,22 @@ export abstract class BaseResizeViewAction extends Action { } protected resizePart(sizeChange: number): void { - const isEditorFocus = this.partService.hasFocus(Parts.EDITOR_PART); const isSidebarFocus = this.partService.hasFocus(Parts.SIDEBAR_PART); const isPanelFocus = this.partService.hasFocus(Parts.PANEL_PART); + let part: Parts; if (isSidebarFocus) { - this.partService.resizePart(Parts.SIDEBAR_PART, sizeChange); - } - else if (isPanelFocus) { - this.partService.resizePart(Parts.PANEL_PART, sizeChange); + part = Parts.SIDEBAR_PART; + } else if (isPanelFocus) { + part = Parts.PANEL_PART; + } else if (isEditorFocus) { + part = Parts.EDITOR_PART; } - else if (isEditorFocus) { - this.partService.resizePart(Parts.EDITOR_PART, sizeChange); + + if (part) { + this.partService.resizePart(part, sizeChange); } - return; } } diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index ccf8a22a58a49e309de30556a5225eaa68ceedcd..335dcbe1a794c210e879c05c0d5dfd97eeb75ca3 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -1149,18 +1149,15 @@ export class Workbench implements IPartService { // Resize requested part along the main axis // layout will do all the math for us and adjusts the other Parts public resizePart(part: Parts, sizeChange: number): void { - switch (part) { case Parts.SIDEBAR_PART: case Parts.PANEL_PART: case Parts.EDITOR_PART: this.workbenchLayout.resizePart(part, sizeChange); break; - // Cannot resize other parts default: - return; + return; // Cannot resize other parts } - return; } diff --git a/src/vs/workbench/services/group/common/groupService.ts b/src/vs/workbench/services/group/common/groupService.ts index caf2a18ae40763f9ec46cb4ae88df938a61a0eec..4f0ec01d2647cb9782c1536c3f8bc380f1ae3bc0 100644 --- a/src/vs/workbench/services/group/common/groupService.ts +++ b/src/vs/workbench/services/group/common/groupService.ts @@ -98,10 +98,10 @@ export interface IEditorGroupService { */ getGroupOrientation(): GroupOrientation; - /* - Resize visible editor groups - */ - resizeGroup(position: Position, groupSizeChange: number): boolean; + /** + * Resize visible editor groups + */ + resizeGroup(position: Position, groupSizeChange: number): void; /** * Adds the pinned state to an editor, removing it from being a preview editor. @@ -131,5 +131,4 @@ export interface IEditorGroupService { * Returns tab options. */ getTabOptions(): ITabOptions; - } \ No newline at end of file diff --git a/src/vs/workbench/services/part/common/partService.ts b/src/vs/workbench/services/part/common/partService.ts index cf1e0cb7ab3b0570bd8ee3c4fb311e55e718d946..c1fd22b2dc7d4d064e802b0873b98410c87768f8 100644 --- a/src/vs/workbench/services/part/common/partService.ts +++ b/src/vs/workbench/services/part/common/partService.ts @@ -121,5 +121,4 @@ export interface IPartService { * Resizes currently focused part on main access */ resizePart(part: Parts, sizeChange: number): void; - } \ No newline at end of file diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 9664663442bc3a0ea8742404f93fe2b8b55b80ea..d17745efd551c722aad0e8845fd3aa47d5d2d42a 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -459,8 +459,8 @@ export class TestEditorGroupService implements IEditorGroupService { return 'vertical'; } - public resizeGroup(position: Position, groupSizeChange: number): boolean { - return true; + public resizeGroup(position: Position, groupSizeChange: number): void { + } public pinEditor(group: IEditorGroup, input: IEditorInput): void;