Skip to content

Commit 12656dc

Browse files
authored
aux window - fix issue with restoring when main window is empty (#201698)
1 parent df8db3a commit 12656dc

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
251251
return !!this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
252252
}
253253

254-
private _didRestoreState = false;
255-
get didRestoreState(): boolean { return this._didRestoreState; }
254+
private _willRestoreState = false;
255+
get willRestoreState(): boolean { return this._willRestoreState; }
256256

257257
getGroups(order = GroupsOrder.CREATION_TIME): IEditorGroupView[] {
258258
switch (order) {
@@ -986,7 +986,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
986986
));
987987

988988
// Grid control
989-
this.doCreateGridControl(options);
989+
this._willRestoreState = !options || options.restorePreviousState;
990+
this.doCreateGridControl();
990991

991992
// Centered layout widget
992993
this.centeredLayoutWidget = this._register(new CenteredViewLayout(this.container, this.gridWidgetView, this.profileMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY], this._partOptions.centeredLayoutFixedWidth));
@@ -1145,11 +1146,11 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
11451146
return false;
11461147
}
11471148

1148-
private doCreateGridControl(options?: IEditorPartCreationOptions): void {
1149+
private doCreateGridControl(): void {
11491150

11501151
// Grid Widget (with previous UI state)
11511152
let restoreError = false;
1152-
if (!options || options.restorePreviousState) {
1153+
if (this._willRestoreState) {
11531154
restoreError = !this.doCreateGridControlWithPreviousState();
11541155
}
11551156

@@ -1179,9 +1180,6 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
11791180

11801181
// Grid Widget
11811182
this.doCreateGridControlWithState(uiState.serializedGrid, uiState.activeGroup);
1182-
1183-
// Remember that we did restore previous state
1184-
this._didRestoreState = true;
11851183
} catch (error) {
11861184

11871185
// Log error

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class EditorParts extends MultiWindowParts<EditorPart> implements IEditor
203203
// when the main part did restore. It is possible
204204
// that restoring was not attempted because specific
205205
// editors were opened.
206-
if (this.mainPart.didRestoreState) {
206+
if (this.mainPart.willRestoreState) {
207207
const uiState: IEditorPartsUIState | undefined = this.workspaceMemento[EditorParts.EDITOR_PARTS_UI_STATE_STORAGE_KEY];
208208
if (uiState?.auxiliary.length) {
209209
const auxiliaryEditorPartPromises: Promise<IAuxiliaryEditorPart>[] = [];

0 commit comments

Comments
 (0)