From a6a7af4d44f3b6ad847748c267869671cdc8e6d8 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:50:45 +0200 Subject: [PATCH 1/3] fallback to port.address if addressLabel is false --- .../src/browser/boards/boards-toolbar-item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx b/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx index 93a15a3c5..048fdb8d6 100644 --- a/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx +++ b/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx @@ -138,7 +138,7 @@ export class BoardsDropDown extends React.Component { {boardLabel}
- {port.addressLabel} + {port.addressLabel || port.address}
{selected ?
: ''} From 0b0ce7b06026da35bc1459d14a8c156f49e0fcc6 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:58:56 +0200 Subject: [PATCH 2/3] addressLabel if possible, reconcileAvailableBoards --- .../src/browser/boards/boards-service-provider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 0f0fbbea9..c639a7eb0 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -578,6 +578,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution { boardsConfig.selectedBoard && availableBoards.every(({ selected }) => !selected) ) { + let port = boardsConfig.selectedPort // If the selected board has the same port of an unknown board // that is already in availableBoards we might get a duplicate port. // So we remove the one already in the array and add the selected one. @@ -585,11 +586,15 @@ export class BoardsServiceProvider implements FrontendApplicationContribution { (board) => board.port?.address === boardsConfig.selectedPort?.address ); if (found >= 0) { + // get the "Unknown board port" that we will substitute, + // then we can include it in the "availableBoard object" + // pushed below; to ensure addressLabel is included + port = availableBoards[found].port availableBoards.splice(found, 1); } availableBoards.push({ ...boardsConfig.selectedBoard, - port: boardsConfig.selectedPort, + port, selected: true, state: AvailableBoard.State.incomplete, }); From d3f29cbdd04f8081adc41b5b10901975a620c827 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:59:40 +0200 Subject: [PATCH 3/3] remove fallback --- .../src/browser/boards/boards-toolbar-item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx b/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx index 048fdb8d6..93a15a3c5 100644 --- a/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx +++ b/arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx @@ -138,7 +138,7 @@ export class BoardsDropDown extends React.Component { {boardLabel}
- {port.addressLabel || port.address} + {port.addressLabel}
{selected ?
: ''}