@@ -286,49 +286,46 @@ PID: ${PID}`;
286
286
for ( let i = 0 ; i < sortedAddresses . length ; i ++ ) {
287
287
const address = sortedAddresses [ i ] ;
288
288
const [ port , boards ] = ports [ address ] ;
289
- if ( ! boards . length ) {
290
- boards . push ( { name : '' } ) ;
289
+ let label = `${ address } ` ;
290
+ if ( boards . length ) {
291
+ const boardsList = boards . map ( ( board ) => board . name ) . join ( ', ' ) ;
292
+ label = `${ label } (${ boardsList } )` ;
291
293
}
292
- for ( const { name, fqbn } of boards ) {
293
- const id = `arduino-select-port--${ address } ${
294
- fqbn ? `--${ fqbn } ` : ''
295
- } `;
296
- const command = { id } ;
297
- const handler = {
298
- execute : ( ) => {
299
- if (
300
- ! Port . equals (
301
- port ,
302
- this . boardsServiceProvider . boardsConfig . selectedPort
303
- )
304
- ) {
305
- this . boardsServiceProvider . boardsConfig = {
306
- selectedBoard :
307
- this . boardsServiceProvider . boardsConfig . selectedBoard ,
308
- selectedPort : port ,
309
- } ;
310
- }
311
- } ,
312
- isToggled : ( ) =>
313
- Port . equals (
294
+ const id = `arduino-select-port--${ address } ` ;
295
+ const command = { id } ;
296
+ const handler = {
297
+ execute : ( ) => {
298
+ if (
299
+ ! Port . equals (
314
300
port ,
315
301
this . boardsServiceProvider . boardsConfig . selectedPort
316
- ) ,
317
- } ;
318
- const label = `${ address } ${ name ? ` (${ name } )` : '' } ` ;
319
- const menuAction = {
320
- commandId : id ,
321
- label,
322
- order : `${ protocolOrder + i + 1 } ` ,
323
- } ;
324
- this . commandRegistry . registerCommand ( command , handler ) ;
325
- this . toDisposeBeforeMenuRebuild . push (
326
- Disposable . create ( ( ) =>
327
- this . commandRegistry . unregisterCommand ( command )
328
- )
329
- ) ;
330
- this . menuModelRegistry . registerMenuAction ( menuPath , menuAction ) ;
331
- }
302
+ )
303
+ ) {
304
+ this . boardsServiceProvider . boardsConfig = {
305
+ selectedBoard :
306
+ this . boardsServiceProvider . boardsConfig . selectedBoard ,
307
+ selectedPort : port ,
308
+ } ;
309
+ }
310
+ } ,
311
+ isToggled : ( ) =>
312
+ Port . equals (
313
+ port ,
314
+ this . boardsServiceProvider . boardsConfig . selectedPort
315
+ ) ,
316
+ } ;
317
+ const menuAction = {
318
+ commandId : id ,
319
+ label,
320
+ order : `${ protocolOrder + i + 1 } ` ,
321
+ } ;
322
+ this . commandRegistry . registerCommand ( command , handler ) ;
323
+ this . toDisposeBeforeMenuRebuild . push (
324
+ Disposable . create ( ( ) =>
325
+ this . commandRegistry . unregisterCommand ( command )
326
+ )
327
+ ) ;
328
+ this . menuModelRegistry . registerMenuAction ( menuPath , menuAction ) ;
332
329
}
333
330
} ;
334
331
0 commit comments