Fix editor tabs order (#612)

This commit is contained in:
Francesco Stasi
2021-11-23 12:16:56 +01:00
committed by GitHub
parent 13734a642c
commit 9863dc2f90
2 changed files with 9 additions and 5 deletions

View File

@@ -35,13 +35,18 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer {
const layoutData = await this.inflate(serializedLayoutData);
// workaround to remove duplicated tabs
const filesUri: string[] = [];
if ((layoutData as any)?.mainPanel?.main?.widgets) {
(layoutData as any).mainPanel.main.widgets = (
layoutData as any
).mainPanel.main.widgets.filter(
(widget: any) =>
widget.constructionOptions.factoryId !== 'code-editor-opener'
);
).mainPanel.main.widgets.filter((widget: any) => {
const uri = widget.getResourceUri().toString();
if (filesUri.includes(uri)) {
return false;
}
filesUri.push(uri);
return true;
});
}
await app.shell.setLayoutData(layoutData);