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 3546f20

Browse files
author
Alberto Iannaccone
committed
Fix boards listing
1 parent ae76432 commit 3546f20

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,15 @@ PID: ${PID}`;
199199
});
200200

201201
// Installed boards
202-
for(constboardofinstalledBoards) {
202+
installedBoards.forEach((board,index)=> {
203203
const { packageId, packageName, fqbn, name, manuallyInstalled } = board;
204204

205205
const packageLabel =
206206
packageName +
207-
`${manuallyInstalled
208-
? nls.localize('arduino/board/inSketchbook', ' (in Sketchbook)')
209-
: ''
207+
`${
208+
manuallyInstalled
209+
? nls.localize('arduino/board/inSketchbook', ' (in Sketchbook)')
210+
: ''
210211
}`;
211212
// Platform submenu
212213
const platformMenuPath = [...boardsPackagesGroup, packageId];
@@ -239,14 +240,18 @@ PID: ${PID}`;
239240
};
240241

241242
// Board menu
242-
const menuAction = { commandId: id, label: name };
243+
const menuAction = {
244+
commandId: id,
245+
label: name,
246+
order: `${index}`,
247+
};
243248
this.commandRegistry.registerCommand(command, handler);
244249
this.toDisposeBeforeMenuRebuild.push(
245250
Disposable.create(() => this.commandRegistry.unregisterCommand(command))
246251
);
247252
this.menuModelRegistry.registerMenuAction(platformMenuPath, menuAction);
248253
// Note: we do not dispose the menu actions individually. Calling `unregisterSubmenu` on the parent will wipe the children menu nodes recursively.
249-
}
254+
});
250255

251256
// Installed ports
252257
const registerPorts = (
@@ -282,11 +287,13 @@ PID: ${PID}`;
282287

283288
// First we show addresses with recognized boards connected,
284289
// then all the rest.
285-
const sortedIDs = Object.keys(ports).sort((left: string, right: string): number => {
286-
const [, leftBoards] = ports[left];
287-
const [, rightBoards] = ports[right];
288-
return rightBoards.length - leftBoards.length;
289-
});
290+
const sortedIDs = Object.keys(ports).sort(
291+
(left: string, right: string): number => {
292+
const [, leftBoards] = ports[left];
293+
const [, rightBoards] = ports[right];
294+
return rightBoards.length - leftBoards.length;
295+
}
296+
);
290297

291298
for (let i = 0; i < sortedIDs.length; i++) {
292299
const portID = sortedIDs[i];

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { CoreClientAware } from './core-client-provider';
3232
import {
3333
BoardDetailsRequest,
3434
BoardDetailsResponse,
35-
BoardSearchRequest,
35+
BoardListAllRequest,
3636
} from './cli-protocol/cc/arduino/cli/commands/v1/board_pb';
3737
import {
3838
ListProgrammersAvailableForUploadRequest,
@@ -196,11 +196,11 @@ export class BoardsServiceImpl
196196
query?: string;
197197
}): Promise<BoardWithPackage[]> {
198198
const { instance, client } = await this.coreClient;
199-
const req = new BoardSearchRequest();
200-
req.setSearchArgs(query || '');
199+
const req = new BoardListAllRequest();
200+
req.addSearchArgs(query || '');
201201
req.setInstance(instance);
202202
const boards = await new Promise<BoardWithPackage[]>((resolve, reject) => {
203-
client.boardSearch(req, (error, resp) => {
203+
client.boardListAll(req, (error, resp) => {
204204
if (error) {
205205
reject(error);
206206
return;

0 commit comments

Comments
(0)

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