diff --git a/arduino-ide-extension/src/browser/contributions/sketch-control.ts b/arduino-ide-extension/src/browser/contributions/sketch-control.ts index 8b04eaa3f..87f24e739 100644 --- a/arduino-ide-extension/src/browser/contributions/sketch-control.ts +++ b/arduino-ide-extension/src/browser/contributions/sketch-control.ts @@ -87,7 +87,7 @@ export class SketchControl extends SketchContribution { currentSketch && parentsketch && parentsketch.uri === currentSketch.uri && - (await this.allowRename(parentsketch.uri)) + this.allowRename(parentsketch.uri) ) { this.menuRegistry.registerMenuAction( ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP, @@ -124,7 +124,7 @@ export class SketchControl extends SketchContribution { currentSketch && parentsketch && parentsketch.uri === currentSketch.uri && - (await this.allowDelete(parentsketch.uri)) + this.allowDelete(parentsketch.uri) ) { this.menuRegistry.registerMenuAction( ArduinoMenus.SKETCH_CONTROL__CONTEXT__MAIN_GROUP, @@ -249,20 +249,24 @@ export class SketchControl extends SketchContribution { }); } - protected async isCloudSketch(uri: string) { - const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri)); + protected isCloudSketch(uri: string): boolean { + try { + const cloudCacheLocation = this.localCacheFsProvider.from(new URI(uri)); - if (cloudCacheLocation) { - return true; + if (cloudCacheLocation) { + return true; + } + return false; + } catch { + return false; } - return false; } - protected async allowRename(uri: string) { + protected allowRename(uri: string): boolean { return !this.isCloudSketch(uri); } - protected async allowDelete(uri: string) { + protected allowDelete(uri: string): boolean { return !this.isCloudSketch(uri); } } diff --git a/arduino-ide-extension/src/browser/style/editor.css b/arduino-ide-extension/src/browser/style/editor.css index 220c7bd3d..5be2d405d 100644 --- a/arduino-ide-extension/src/browser/style/editor.css +++ b/arduino-ide-extension/src/browser/style/editor.css @@ -4,3 +4,7 @@ background-size: 13px; background-image: var(--theia-icon-circle); } + +.monaco-list-row.show-file-icons.focused { + background-color: #d6ebff; +} diff --git a/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts b/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts index 30769be0a..92ad44237 100644 --- a/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts +++ b/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts @@ -22,4 +22,30 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer { } } } + + async restoreLayout(app: FrontendApplication): Promise { + this.logger.info('>>> Restoring the layout state...'); + const serializedLayoutData = await this.storageService.getData( + this.storageKey + ); + if (serializedLayoutData === undefined) { + this.logger.info('<<< Nothing to restore.'); + return false; + } + + const layoutData = await this.inflate(serializedLayoutData); + // workaround to remove duplicated tabs + 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' + ); + } + + await app.shell.setLayoutData(layoutData); + this.logger.info('<<< The layout has been successfully restored.'); + return true; + } } diff --git a/arduino-ide-extension/src/test/browser/monitor-utils.test.ts b/arduino-ide-extension/src/test/browser/monitor-utils.test.ts index 3e1e90e6d..f3056da48 100644 --- a/arduino-ide-extension/src/test/browser/monitor-utils.test.ts +++ b/arduino-ide-extension/src/test/browser/monitor-utils.test.ts @@ -125,7 +125,7 @@ testLines.forEach((t) => ) ); -describe.only('Monitor Utils', () => { +describe('Monitor Utils', () => { beforeEach(() => { set(date); });