From eafa0add6ef0d6d1e2a1e5595d9c476579d5f25d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 2 Oct 2018 10:07:50 +0200 Subject: [PATCH] fix #59752 --- .../workbench/browser/parts/editor/editorPart.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 9152d2db48e..4a77d44d5e0 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -865,6 +865,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor } // Create new + const groupViews: IEditorGroupView[] = []; const gridWidget = SerializableGrid.deserialize(serializedGrid, { fromJSON: (serializedEditorGroup: ISerializedEditorGroup) => { let groupView: IEditorGroupView; @@ -874,6 +875,8 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor groupView = this.doCreateGroupView(serializedEditorGroup); } + groupViews.push(groupView); + if (groupView.id === activeGroupId) { this.doSetGroupActive(groupView); } @@ -882,6 +885,18 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor } }, { styles: { separatorBorder: this.gridSeparatorBorder } }); + // If the active group was not found when restoring the grid + // make sure to make at least one group active. We always need + // an active group. + if (!this._activeGroup) { + this.doSetGroupActive(groupViews[0]); + } + + // Validate MRU group views matches grid widget state + if (this.mostRecentActiveGroups.some(groupId => !this.getGroup(groupId))) { + this.mostRecentActiveGroups = groupViews.map(group => group.id); + } + // Set it this.doSetGridWidget(gridWidget); } -- GitLab