Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 10d2662

Browse files
author
Alberto Iannaccone
committed
use arduio-cli sorting fix
1 parent 3546f20 commit 10d2662

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

‎arduino-ide-extension/package.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@
158158
],
159159
"arduino": {
160160
"cli": {
161-
"version": "0.27.1"
161+
"version": {
162+
"owner": "arduino",
163+
"repo": "arduino-cli",
164+
"commitish": "3d5a87e"
165+
}
162166
},
163167
"fwuploader": {
164168
"version": "2.2.0"

‎arduino-ide-extension/src/browser/contributions/board-selection.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ PID: ${PID}`;
361361
}
362362

363363
protected async installedBoards(): Promise<InstalledBoardWithPackage[]> {
364-
const allBoards = await this.boardsService.searchBoards({});
364+
const allBoards = await this.boardsService.getInstalledBoards();
365365
return allBoards.filter(InstalledBoardWithPackage.is);
366366
}
367367
}

‎arduino-ide-extension/src/common/protocol/boards-service.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export interface BoardsService
141141
fqbn: string;
142142
}): Promise<BoardsPackage | undefined>;
143143
searchBoards({ query }: { query?: string }): Promise<BoardWithPackage[]>;
144+
getInstalledBoards(): Promise<BoardWithPackage[]>;
144145
getBoardUserFields(options: {
145146
fqbn: string;
146147
protocol: string;

‎arduino-ide-extension/src/node/boards-service-impl.ts‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
BoardDetailsRequest,
3434
BoardDetailsResponse,
3535
BoardListAllRequest,
36+
BoardSearchRequest,
3637
} from './cli-protocol/cc/arduino/cli/commands/v1/board_pb';
3738
import {
3839
ListProgrammersAvailableForUploadRequest,
@@ -195,9 +196,38 @@ export class BoardsServiceImpl
195196
}: {
196197
query?: string;
197198
}): Promise<BoardWithPackage[]> {
199+
const { instance, client } = await this.coreClient;
200+
const req = new BoardSearchRequest();
201+
req.setSearchArgs(query || '');
202+
req.setInstance(instance);
203+
const boards = await new Promise<BoardWithPackage[]>((resolve, reject) => {
204+
client.boardSearch(req, (error, resp) => {
205+
if (error) {
206+
reject(error);
207+
return;
208+
}
209+
const boards: Array<BoardWithPackage> = [];
210+
for (const board of resp.getBoardsList()) {
211+
const platform = board.getPlatform();
212+
if (platform) {
213+
boards.push({
214+
name: board.getName(),
215+
fqbn: board.getFqbn(),
216+
packageId: platform.getId(),
217+
packageName: platform.getName(),
218+
manuallyInstalled: platform.getManuallyInstalled(),
219+
});
220+
}
221+
}
222+
resolve(boards);
223+
});
224+
});
225+
return boards;
226+
}
227+
228+
async getInstalledBoards(): Promise<BoardWithPackage[]> {
198229
const { instance, client } = await this.coreClient;
199230
const req = new BoardListAllRequest();
200-
req.addSearchArgs(query || '');
201231
req.setInstance(instance);
202232
const boards = await new Promise<BoardWithPackage[]>((resolve, reject) => {
203233
client.boardListAll(req, (error, resp) => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /