@@ -270,38 +270,36 @@ PID: ${PID}`;
270
270
for ( let i = 0 ; i < sortedAddresses . length ; i ++ ) {
271
271
const address = sortedAddresses [ i ] ;
272
272
const [ port , boards ] = ports [ address ] ;
273
- if ( ! boards . length ) {
274
- boards . push ( { name : '' } ) ;
273
+ let label = `${ address } ` ;
274
+ if ( boards . length ) {
275
+ const boardsList = boards . map ( board => board . name ) . join ( ", " )
276
+ label = `${ label } (${ boardsList } )`
275
277
}
276
- for ( const { name, fqbn } of boards ) {
277
- const id = `arduino-select-port--${ address } ${ fqbn ? `--${ fqbn } ` : '' } ` ;
278
- const command = { id } ;
279
- const handler = {
280
- execute : ( ) => {
281
- if ( ! Port . equals ( port , this . boardsServiceProvider . boardsConfig . selectedPort ) ) {
282
- this . boardsServiceProvider . boardsConfig = {
283
- selectedBoard :
284
- this . boardsServiceProvider . boardsConfig . selectedBoard ,
285
- selectedPort : port ,
286
- } ;
287
- }
288
- } ,
289
- isToggled : ( ) => Port . equals ( port , this . boardsServiceProvider . boardsConfig . selectedPort ) ,
290
- }
291
- const label = `${ address } ${ name ? ` (${ name } )` : '' } ` ;
292
- const menuAction = {
293
- commandId : id ,
294
- label,
295
- order : `${ protocolOrder + i + 1 } ` ,
296
- } ;
297
- this . commandRegistry . registerCommand ( command , handler ) ;
298
- this . toDisposeBeforeMenuRebuild . push (
299
- Disposable . create ( ( ) =>
300
- this . commandRegistry . unregisterCommand ( command )
301
- )
302
- ) ;
303
- this . menuModelRegistry . registerMenuAction ( menuPath , menuAction ) ;
278
+ const id = `arduino-select-port--${ address } ` ;
279
+ const command = { id } ;
280
+ const handler = {
281
+ execute : ( ) => {
282
+ if ( ! Port . equals ( port , this . boardsServiceProvider . boardsConfig . selectedPort ) ) {
283
+ this . boardsServiceProvider . boardsConfig = {
284
+ selectedBoard : this . boardsServiceProvider . boardsConfig . selectedBoard ,
285
+ selectedPort : port ,
286
+ } ;
287
+ }
288
+ } ,
289
+ isToggled : ( ) => Port . equals ( port , this . boardsServiceProvider . boardsConfig . selectedPort ) ,
290
+ }
291
+ const menuAction = {
292
+ commandId : id ,
293
+ label,
294
+ order : `${ protocolOrder + i + 1 } `
304
295
}
296
+ this . commandRegistry . registerCommand ( command , handler ) ;
297
+ this . toDisposeBeforeMenuRebuild . push (
298
+ Disposable . create ( ( ) =>
299
+ this . commandRegistry . unregisterCommand ( command )
300
+ )
301
+ ) ;
302
+ this . menuModelRegistry . registerMenuAction ( menuPath , menuAction ) ;
305
303
}
306
304
} ;
307
305
0 commit comments