mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-10 02:48:33 +00:00
ATL-1195: Show examples if no board is selected.
Show all examples: - when no board is selected, - when the core is not installed for the selected board. Otherwise, show examples for the currently selected board only. Only get libraries from the cores when the FQBN is defined. Otherwise, we retrieve user installed libraries only. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -154,15 +154,14 @@ export class LibraryExamples extends Examples {
|
||||
protected async register(board: Board | undefined = this.boardsServiceClient.boardsConfig.selectedBoard): Promise<void> {
|
||||
return this.queue.add(async () => {
|
||||
this.toDispose.dispose();
|
||||
if (!board || !board.fqbn) {
|
||||
return;
|
||||
}
|
||||
const { fqbn, name } = board;
|
||||
const fqbn = board?.fqbn;
|
||||
const name = board?.name;
|
||||
// Shows all examples when no board is selected, or the platform of the currently selected board is not installed.
|
||||
const { user, current, any } = await this.examplesService.installed({ fqbn });
|
||||
if (user.length) {
|
||||
(user as any).unshift('Examples from Custom Libraries');
|
||||
}
|
||||
if (current.length) {
|
||||
if (name && fqbn && current.length) {
|
||||
(current as any).unshift(`Examples for ${name}`);
|
||||
}
|
||||
if (any.length) {
|
||||
|
||||
Reference in New Issue
Block a user