Skip to content

Commit 82d3c34

Browse files
author
Akos Kitta
committed
fix(regression): find board match in dialog
when platform is not installed Ref: arduino#2149 (comment) Signed-off-by: Akos Kitta <[email protected]>
1 parent e9004b0 commit 82d3c34

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Diff for: arduino-ide-extension/src/common/protocol/boards-service.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,13 @@ export namespace Board {
522522
const counter = distinctBoardNames.get(name) || 0;
523523
distinctBoardNames.set(name, counter + 1);
524524
}
525-
525+
let selectedBoardPackageId: string | undefined = undefined;
526+
if (selectedBoard?.fqbn) {
527+
selectedBoardPackageId = selectedBoard.fqbn
528+
.split(':')
529+
.slice(0, 2)
530+
.join(':');
531+
}
526532
// Due to the non-unique board names, we have to check the package name as well.
527533
const selected = (board: BoardWithPackage) => {
528534
if (!!selectedBoard) {
@@ -532,15 +538,13 @@ export namespace Board {
532538
selectedBoard
533539
)
534540
) {
535-
// TODO: this won't work anymore with the current BoardIdentifier as it does not contain the container packager info.
536-
// Possible duplicate items in board select dialog for non-installed boards from different platforms.
537-
if ('packageName' in selectedBoard) {
538-
return board.packageName === (selectedBoard as any).packageName;
541+
if (selectedBoardPackageId) {
542+
return board.packageId === selectedBoardPackageId;
539543
}
540-
if ('packageId' in selectedBoard) {
541-
return board.packageId === (selectedBoard as any).packageId;
544+
if (!board.fqbn && board.name === selectedBoard.name) {
545+
return true;
542546
}
543-
return true;
547+
return false;
544548
}
545549
}
546550
return false;

0 commit comments

Comments
 (0)