From 9cc49319df60ef08242933fb8374ea6490db213b Mon Sep 17 00:00:00 2001 From: Francesco Spissu Date: Wed, 24 Aug 2022 15:48:00 +0200 Subject: [PATCH 1/5] remove return if fqbn address is not available --- .../src/browser/contributions/upload-sketch.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/arduino-ide-extension/src/browser/contributions/upload-sketch.ts b/arduino-ide-extension/src/browser/contributions/upload-sketch.ts index d3278f0ec..b3ef668d2 100644 --- a/arduino-ide-extension/src/browser/contributions/upload-sketch.ts +++ b/arduino-ide-extension/src/browser/contributions/upload-sketch.ts @@ -61,9 +61,6 @@ export class UploadSketch extends CoreServiceContribution { registry.registerCommand(UploadSketch.Commands.UPLOAD_SKETCH, { execute: async () => { const key = this.selectedFqbnAddress(); - if (!key) { - return; - } if (this.boardRequiresUserFields && !this.cachedUserFields.has(key)) { // Deep clone the array of board fields to avoid editing the cached ones this.userFieldsDialog.value = ( From 5b6bfe11aafe409c84802079216ae311da3c9066 Mon Sep 17 00:00:00 2001 From: Francesco Spissu Date: Thu, 25 Aug 2022 13:07:10 +0200 Subject: [PATCH 2/5] update error message --- .../src/browser/contributions/contribution.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arduino-ide-extension/src/browser/contributions/contribution.ts b/arduino-ide-extension/src/browser/contributions/contribution.ts index 309a72dbc..e818e9127 100644 --- a/arduino-ide-extension/src/browser/contributions/contribution.ts +++ b/arduino-ide-extension/src/browser/contributions/contribution.ts @@ -222,6 +222,14 @@ export abstract class CoreServiceContribution extends SketchContribution { } catch {} } if (message) { + if ( + message.includes( + 'Compilation error: Missing FQBN (Fully Qualified Board Name)' + ) + ) { + message = + 'No board selected. Please select your Arduino board from the Tools > Board menu.'; + } const copyAction = nls.localize( 'arduino/coreContribution/copyError', 'Copy error messages' From 99d1a7b78c486d0d15b002b2c0c426306dd186a7 Mon Sep 17 00:00:00 2001 From: Francesco Spissu Date: Thu, 25 Aug 2022 14:31:41 +0200 Subject: [PATCH 3/5] update includes --- .../src/browser/contributions/contribution.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arduino-ide-extension/src/browser/contributions/contribution.ts b/arduino-ide-extension/src/browser/contributions/contribution.ts index e818e9127..ed0f5c6ac 100644 --- a/arduino-ide-extension/src/browser/contributions/contribution.ts +++ b/arduino-ide-extension/src/browser/contributions/contribution.ts @@ -222,11 +222,7 @@ export abstract class CoreServiceContribution extends SketchContribution { } catch {} } if (message) { - if ( - message.includes( - 'Compilation error: Missing FQBN (Fully Qualified Board Name)' - ) - ) { + if (message.includes('Missing FQBN (Fully Qualified Board Name)')) { message = 'No board selected. Please select your Arduino board from the Tools > Board menu.'; } From 922963e05829314f3be2dde7d98d04e04eb81df6 Mon Sep 17 00:00:00 2001 From: Francesco Spissu Date: Thu, 25 Aug 2022 16:52:31 +0200 Subject: [PATCH 4/5] add key check in board user fields logic --- .../src/browser/contributions/upload-sketch.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/contributions/upload-sketch.ts b/arduino-ide-extension/src/browser/contributions/upload-sketch.ts index b3ef668d2..a6be799f9 100644 --- a/arduino-ide-extension/src/browser/contributions/upload-sketch.ts +++ b/arduino-ide-extension/src/browser/contributions/upload-sketch.ts @@ -61,7 +61,11 @@ export class UploadSketch extends CoreServiceContribution { registry.registerCommand(UploadSketch.Commands.UPLOAD_SKETCH, { execute: async () => { const key = this.selectedFqbnAddress(); - if (this.boardRequiresUserFields && !this.cachedUserFields.has(key)) { + if ( + this.boardRequiresUserFields && + key && + !this.cachedUserFields.has(key) + ) { // Deep clone the array of board fields to avoid editing the cached ones this.userFieldsDialog.value = ( await this.boardsServiceProvider.selectedBoardUserFields() From d4a8ad84dd246326741b2b531137f22f277e0567 Mon Sep 17 00:00:00 2001 From: Francesco Spissu Date: Fri, 26 Aug 2022 10:27:35 +0200 Subject: [PATCH 5/5] add localization for no board selected msg --- .../src/browser/contributions/contribution.ts | 6 ++++-- i18n/en.json | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arduino-ide-extension/src/browser/contributions/contribution.ts b/arduino-ide-extension/src/browser/contributions/contribution.ts index ed0f5c6ac..920e4dfd9 100644 --- a/arduino-ide-extension/src/browser/contributions/contribution.ts +++ b/arduino-ide-extension/src/browser/contributions/contribution.ts @@ -223,8 +223,10 @@ export abstract class CoreServiceContribution extends SketchContribution { } if (message) { if (message.includes('Missing FQBN (Fully Qualified Board Name)')) { - message = - 'No board selected. Please select your Arduino board from the Tools > Board menu.'; + message = nls.localize( + 'arduino/coreContribution/noBoardSelected', + 'No board selected. Please select your Arduino board from the Tools > Board menu.' + ); } const copyAction = nls.localize( 'arduino/coreContribution/copyError', diff --git a/i18n/en.json b/i18n/en.json index 1b8a65f74..014067cc6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -132,7 +132,8 @@ "replaceTitle": "Replace" }, "coreContribution": { - "copyError": "Copy error messages" + "copyError": "Copy error messages", + "noBoardSelected": "No board selected. Please select your Arduino board from the Tools > Board menu." }, "daemon": { "restart": "Restart Daemon",