Skip to content

Commit 9863dc2

Browse files
authored
Fix editor tabs order (#612)
1 parent 13734a6 commit 9863dc2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ export class ArduinoFrontendContribution
508508
for (const uri of [mainFileUri, ...rootFolderFileUris]) {
509509
await this.ensureOpened(uri);
510510
}
511-
await this.ensureOpened(mainFileUri, true);
512511
if (mainFileUri.endsWith('.pde')) {
513512
const message = nls.localize(
514513
'arduino/common/oldFormat',

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

+9-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer {
3535

3636
const layoutData = await this.inflate(serializedLayoutData);
3737
// workaround to remove duplicated tabs
38+
const filesUri: string[] = [];
3839
if ((layoutData as any)?.mainPanel?.main?.widgets) {
3940
(layoutData as any).mainPanel.main.widgets = (
4041
layoutData as any
41-
).mainPanel.main.widgets.filter(
42-
(widget: any) =>
43-
widget.constructionOptions.factoryId !== 'code-editor-opener'
44-
);
42+
).mainPanel.main.widgets.filter((widget: any) => {
43+
const uri = widget.getResourceUri().toString();
44+
if (filesUri.includes(uri)) {
45+
return false;
46+
}
47+
filesUri.push(uri);
48+
return true;
49+
});
4550
}
4651

4752
await app.shell.setLayoutData(layoutData);

0 commit comments

Comments
 (0)