-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
Fix boards listing #1520
Fix boards listing #1520
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. If IDE2 uses board list
instead of board search
, then only boards from installed platforms will be searched.
Steps to reproduce:
- Delete
⚠️ (or rename) thedirectories/data
location, - Start IDE2 from this PR,
- Use the board search.
board-search.mp4
8f9ab6f
to
10d2662
Compare
Right. I've fixed it by adding a separate method to get only the installed boards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reuse the code instead of copy/pasting it.
Done |
Thank you! I will do the verification soon. Which issue does this PR suppose to close? I could not find it in the commits or PR description. The closest was #801. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the boards is not correct for me:
Arduino IDE version
2.0.1-snapshot-3f7230e (tester build for 56f2ac3)
Operating system
Windows 10, Ubuntu 20.04
Additional context
The order is as expected when using Arduino CLI:
$ arduino-cli version
arduino-cli.exe Version: git-snapshot Commit: 3d5a87e1 Date: 2022-10-04T18:01:41Z
$ arduino-cli board listall arduino:avr --format json | jq '.boards[] | .name'
"Arduino Yún"
"Arduino Uno"
"Arduino Uno Mini"
"Arduino Duemilanove or Diecimila"
"Arduino Nano"
"Arduino Mega or Mega 2560"
"Arduino Mega ADK"
"Arduino Leonardo"
"Arduino Leonardo ETH"
"Arduino Micro"
"Arduino Esplora"
"Arduino Mini"
"Arduino Ethernet"
"Arduino Fio"
"Arduino BT"
"LilyPad Arduino USB"
"LilyPad Arduino"
"Arduino Pro or Pro Mini"
"Arduino NG or older"
"Arduino Robot Control"
"Arduino Robot Motor"
"Arduino Gemma"
"Adafruit Circuit Playground"
"Arduino Yún Mini"
"Arduino Industrial 101"
"Linino One"
"Arduino Uno WiFi"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return this.handleListBoards(client.boardListAll.bind(client), req); | ||
} | ||
|
||
async handleListBoards( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visibility should be private
if it's not called from outside of the module.
const menuAction = { | ||
commandId: id, | ||
label: name, | ||
order: `${index}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check them together, but I think this is the classic alphanumeric ordering issue.
% node
Welcome to Node.js v14.19.0.
Type ".help" for more information.
> ['1', '2', '3', '11', '12', '111'].sort()
[ '1', '11', '111', '12', '2', '3' ]
> .exit
With some zero padding, it works for me locally:
diff --git a/arduino-ide-extension/src/browser/contributions/board-selection.ts b/arduino-ide-extension/src/browser/contributions/board-selection.ts
index 2241c925..466e4f63 100644
--- a/arduino-ide-extension/src/browser/contributions/board-selection.ts
+++ b/arduino-ide-extension/src/browser/contributions/board-selection.ts
@@ -243,7 +243,7 @@ PID: ${PID}`;
const menuAction = {
commandId: id,
label: name,
- order: `${index}`,
+ order: String(index).padStart(4), // pads with leading zeros for alphanumeric sort where order is 1, 2, 11, and NOT 1, 11, 2
};
this.commandRegistry.registerCommand(command, handler);
this.toDisposeBeforeMenuRebuild.push(
Great that your changes revealed the flaw in the codebase. These are probably all incorrect:
arduino-ide/arduino-ide-extension/src/browser/boards/boards-data-menu-updater.ts
Line 114 in 61a11a0
order: `${i}`, |
order: `${i}`, |
👇 This probably works only because the open recent is limited to ten items.
arduino-ide/arduino-ide-extension/src/browser/contributions/open-recent-sketch.ts
Line 96 in 61a11a0
order: String(order), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! Thank you for the suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed the suggestion, could you please verify it now?
56f2ac3
to
2d9b072
Compare
@AlbyIanna, I have restarted the failed job. If you mark the PR ready, I will do the final verification. The code looks great. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is working perfectly for me now.
Thanks Alberto!
Motivation
The IDE needs to sort the menu for each platform in Tools > Board (e.g., Tools > Board > Arduino AVR Boards) according to the order of occurrence of the
name
property for each board definitions in the platform'sboards.txt
configuration file.Change description
listall
instead ofsearch
command in the arduino-cliOther information
Fixes #802.
This needed a fix in the CLI to get the correct order: arduino/arduino-cli#1903
This PR is in draft because there isn't a release for the arduino-cli yet, but it can already be tested.
Arduino IDE 2.x before this change:

Arduino IDE 2.x after this change:

Arduino IDE 1.x:

Reviewer checklist