@@ -199,14 +199,15 @@ PID: ${PID}`;
199199 } ) ;
200200
201201 // Installed boards
202- for ( const board of installedBoards ) {
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 ] ;
0 commit comments