From 026e80e7fc803f45e084242f76957235c0315184 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 15 Sep 2022 15:29:28 +0200 Subject: [PATCH] fix #1383: missing port labels (#1412) * fallback to port.address if addressLabel is false * addressLabel if possible, reconcileAvailableBoards * remove fallback --- .../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 25aa8d05..8097e45c 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -600,6 +600,7 @@ export class BoardsServiceProvider 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. @@ -607,11 +608,15 @@ export class BoardsServiceProvider (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, });