Skip to content

Commit 3c13f70

Browse files
committed
remove duplicated tabs on startup
1 parent 5d37f6f commit 3c13f70

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,32 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer {
2222
}
2323
}
2424
}
25+
26+
async restoreLayout(app: FrontendApplication): Promise<boolean> {
27+
this.logger.info('>>> Restoring the layout state...');
28+
const serializedLayoutData = await this.storageService.getData<string>(
29+
this.storageKey
30+
);
31+
if (serializedLayoutData === undefined) {
32+
this.logger.info('<<< Nothing to restore.');
33+
return false;
34+
}
35+
36+
const layoutData = await this.inflate(serializedLayoutData);
37+
// workaround to remove duplicated tabs
38+
if ((layoutData as any)?.mainPanel?.main?.widgets) {
39+
(layoutData as any).mainPanel.main.widgets = (
40+
layoutData as any
41+
).mainPanel.main.widgets.filter(
42+
(widget: any) =>
43+
widget.constructionOptions.factoryId !== 'code-editor-opener'
44+
);
45+
}
46+
47+
await app.shell.setLayoutData(layoutData);
48+
this.logger.info('<<< The layout has been successfully restored.');
49+
return true;
50+
51+
// return super.restoreLayout(app);
52+
}
2553
}

0 commit comments

Comments
 (0)