mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-23 18:18:33 +00:00
fix: library search boosting
Closes #1106 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -17,6 +17,8 @@ import {
|
||||
BoardWithPackage,
|
||||
BoardUserField,
|
||||
BoardSearch,
|
||||
sortComponents,
|
||||
SortGroup,
|
||||
} from '../common/protocol';
|
||||
import {
|
||||
PlatformInstallRequest,
|
||||
@@ -405,7 +407,8 @@ export class BoardsServiceImpl
|
||||
}
|
||||
|
||||
const filter = this.typePredicate(options);
|
||||
return [...packages.values()].filter(filter);
|
||||
const boardsPackages = [...packages.values()].filter(filter);
|
||||
return sortComponents(boardsPackages, boardsPackageSortGroup);
|
||||
}
|
||||
|
||||
private typePredicate(
|
||||
@@ -559,3 +562,14 @@ function isMissingPlatformError(error: unknown): boolean {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function boardsPackageSortGroup(boardsPackage: BoardsPackage): SortGroup {
|
||||
const types: string[] = [];
|
||||
if (boardsPackage.types.includes('Arduino')) {
|
||||
types.push('Arduino');
|
||||
}
|
||||
if (boardsPackage.deprecated) {
|
||||
types.push('Retired');
|
||||
}
|
||||
return types.join('-') as SortGroup;
|
||||
}
|
||||
|
Reference in New Issue
Block a user