Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aux window - fix issue with restoring when main window is empty #201698

Merged
merged 1 commit into from
Jan 3, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/vs/workbench/browser/parts/editor/editorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
return !!this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
}

private _didRestoreState = false;
get didRestoreState(): boolean { return this._didRestoreState; }
private _willRestoreState = false;
get willRestoreState(): boolean { return this._willRestoreState; }

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

// Grid control
this.doCreateGridControl(options);
this._willRestoreState = !options || options.restorePreviousState;
this.doCreateGridControl();

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

private doCreateGridControl(options?: IEditorPartCreationOptions): void {
private doCreateGridControl(): void {

// Grid Widget (with previous UI state)
let restoreError = false;
if (!options || options.restorePreviousState) {
if (this._willRestoreState) {
restoreError = !this.doCreateGridControlWithPreviousState();
}

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

// Grid Widget
this.doCreateGridControlWithState(uiState.serializedGrid, uiState.activeGroup);

// Remember that we did restore previous state
this._didRestoreState = true;
} catch (error) {

// Log error
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/editorParts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class EditorParts extends MultiWindowParts<EditorPart> implements IEditor
// when the main part did restore. It is possible
// that restoring was not attempted because specific
// editors were opened.
if (this.mainPart.didRestoreState) {
if (this.mainPart.willRestoreState) {
const uiState: IEditorPartsUIState | undefined = this.workspaceMemento[EditorParts.EDITOR_PARTS_UI_STATE_STORAGE_KEY];
if (uiState?.auxiliary.length) {
const auxiliaryEditorPartPromises: Promise<IAuxiliaryEditorPart>[] = [];
Expand Down