From 5d37f6f568e49aadb01e8c2b02938feca5ba34fe Mon Sep 17 00:00:00 2001 From: Francesco Stasi Date: Wed, 6 Oct 2021 16:52:28 +0200 Subject: [PATCH 1/4] Restore monaco suggestion highlights --- arduino-ide-extension/src/browser/style/editor.css | 4 ++++ 1 file changed, 4 insertions(+) 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; +} From 3c13f70246396e30dc253827fedaa663d05866ea Mon Sep 17 00:00:00 2001 From: Francesco Stasi Date: Wed, 6 Oct 2021 16:52:42 +0200 Subject: [PATCH 2/4] remove duplicated tabs on startup --- .../theia/core/shell-layout-restorer.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) 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..29c00ae65 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,32 @@ 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; + + // return super.restoreLayout(app); + } } From b49c11c094845f1d674c0a5f7c21b898bb9ef8ce Mon Sep 17 00:00:00 2001 From: Alberto Iannaccone Date: Wed, 6 Oct 2021 17:42:52 +0200 Subject: [PATCH 3/4] fix rename and delete sketch --- .../browser/contributions/sketch-control.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) 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); } } From c999aaa2fd65f8cc5b4430af2837eb2a616d0ae2 Mon Sep 17 00:00:00 2001 From: Alberto Iannaccone Date: Wed, 6 Oct 2021 17:43:34 +0200 Subject: [PATCH 4/4] remove '.only(...)' in tests --- .../src/browser/theia/core/shell-layout-restorer.ts | 2 -- arduino-ide-extension/src/test/browser/monitor-utils.test.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) 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 29c00ae65..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 @@ -47,7 +47,5 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer { await app.shell.setLayoutData(layoutData); this.logger.info('<<< The layout has been successfully restored.'); return true; - - // return super.restoreLayout(app); } } 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); });