File tree 2 files changed +21
-30
lines changed
arduino-ide-extension/src/browser
2 files changed +21
-30
lines changed Original file line number Diff line number Diff line change @@ -189,35 +189,6 @@ export class LibraryListWidget extends ListWidget<
189
189
{ timeout : 3000 }
190
190
) ;
191
191
}
192
-
193
- protected override filterableListSort = (
194
- items : LibraryPackage [ ]
195
- ) : LibraryPackage [ ] => {
196
- const isArduinoTypeComparator = (
197
- left : LibraryPackage ,
198
- right : LibraryPackage
199
- ) => {
200
- const aIsArduinoType = left . types . includes ( 'Arduino' ) ;
201
- const bIsArduinoType = right . types . includes ( 'Arduino' ) ;
202
-
203
- if ( aIsArduinoType && ! bIsArduinoType ) {
204
- return - 1 ;
205
- }
206
-
207
- if ( ! aIsArduinoType && bIsArduinoType ) {
208
- return 1 ;
209
- }
210
-
211
- return 0 ;
212
- } ;
213
-
214
- return items . sort ( ( left , right ) => {
215
- return (
216
- isArduinoTypeComparator ( left , right ) ||
217
- this . defaultSortComparator ( left , right )
218
- ) ;
219
- } ) ;
220
- } ;
221
192
}
222
193
223
194
class MessageBoxDialog extends AbstractDialog < MessageBoxDialog . Result > {
Original file line number Diff line number Diff line change @@ -142,7 +142,27 @@ export abstract class ListWidget<
142
142
}
143
143
144
144
protected filterableListSort = ( items : T [ ] ) : T [ ] => {
145
- return items . sort ( this . defaultSortComparator ) ;
145
+ const isArduinoTypeComparator = ( left : T , right : T ) => {
146
+ const aIsArduinoType = left . types . includes ( 'Arduino' ) ;
147
+ const bIsArduinoType = right . types . includes ( 'Arduino' ) ;
148
+
149
+ if ( aIsArduinoType && ! bIsArduinoType ) {
150
+ return - 1 ;
151
+ }
152
+
153
+ if ( ! aIsArduinoType && bIsArduinoType ) {
154
+ return 1 ;
155
+ }
156
+
157
+ return 0 ;
158
+ } ;
159
+
160
+ return items . sort ( ( left , right ) => {
161
+ return (
162
+ isArduinoTypeComparator ( left , right ) ||
163
+ this . defaultSortComparator ( left , right )
164
+ ) ;
165
+ } ) ;
146
166
} ;
147
167
148
168
render ( ) : React . ReactNode {
You can’t perform that action at this time.
0 commit comments