Skip to content

Commit

Permalink
Fix editor tabs order (arduino#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
fstasi authored Nov 23, 2021
1 parent 13734a6 commit 9863dc2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ export class ArduinoFrontendContribution
for (const uri of [mainFileUri, ...rootFolderFileUris]) {
await this.ensureOpened(uri);
}
await this.ensureOpened(mainFileUri, true);
if (mainFileUri.endsWith('.pde')) {
const message = nls.localize(
'arduino/common/oldFormat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9863dc2

Please sign in to comment.