10000 feat: simplify board and port handling by kittaakos · Pull Request #2165 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

feat: simplify board and port handling #2165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(regression): restore the Unknown board label
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Aug 18, 2023
commit b3b731ad3e6e5c87d8438bf2d6d9590a384a7cba
4 changes: 2 additions & 2 deletions arduino-ide-extension/src/common/protocol/board-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Mutable } from '@theia/core/lib/common/types';
import { Unknown } from '../nls';
import type { Defined } from '../types';
import { naturalCompare } from '../utils';
import {
Expand All @@ -18,7 +19,6 @@ import {
portProtocolComparator,
selectBoard,
unconfirmedBoard,
unknownBoard,
notConnected,
boardIdentifierLabel,
} from './boards-service';
Expand Down Expand Up @@ -326,7 +326,7 @@ function createBoardListItemLabels(item: BoardListItem): BoardListItemLabels {
unconfirmedBoard;
board = { name, fqbn: undefined };
}
const boardLabel = board?.name ?? unknownBoard;
const boardLabel = board?.name ?? Unknown;
let boardLabelWithFqbn = boardLabel;
if (board?.fqbn) {
boardLabelWithFqbn += ` (${board.fqbn})`;
Expand Down
6 changes: 6 additions & 0 deletions arduino-ide-extension/src/test/common/board-list.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from 'chai';
import { Unknown } from '../../common/nls';
import {
BoardListLabels,
createBoardList,
Expand Down Expand Up @@ -322,6 +323,11 @@ describe('board-list', () => {
expect(inferredBoard?.board).to.be.deep.equal(uno);
});

it(`should use the '${Unknown}' as the board label when no boards were discovered on a detected port`, () => {
const { items } = createBoardList({ ...detectedPort(unoSerialPort) });
expect(items[0].labels.boardLabel).to.be.equal(Unknown);
});

describe('defaultAction', () => {
it("'select' should be the default action for identifier boards", () => {
const { items } = createBoardList({
Expand Down
0