@@ -42,6 +42,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
4242 protected readonly onAvailableBoardsChangedEmitter = new Emitter <
4343 AvailableBoard [ ]
4444 > ( ) ;
45+ protected readonly onAvailablePortsChangedEmitter = new Emitter < Port [ ] > ( ) ;
4546
4647 /**
4748 * Used for the auto-reconnecting. Sometimes, the attached board gets disconnected after uploading something to it.
@@ -67,8 +68,8 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
6768 * This even also emitted when the board package for the currently selected board was uninstalled.
6869 */
6970 readonly onBoardsConfigChanged = this . onBoardsConfigChangedEmitter . event ;
70- readonly onAvailableBoardsChanged =
71- this . onAvailableBoardsChangedEmitter . event ;
71+ readonly onAvailableBoardsChanged = this . onAvailableBoardsChangedEmitter . event ;
72+ readonly onAvailablePortsChanged = this . onAvailablePortsChangedEmitter . event ;
7273
7374 onStart ( ) : void {
7475 this . notificationCenter . onAttachedBoardsChanged (
@@ -88,6 +89,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
8889 ] ) . then ( ( [ attachedBoards , availablePorts ] ) => {
8990 this . _attachedBoards = attachedBoards ;
9091 this . _availablePorts = availablePorts ;
92+ this . onAvailablePortsChangedEmitter . fire ( this . _availablePorts ) ;
9193 this . reconcileAvailableBoards ( ) . then ( ( ) => this . tryReconnect ( ) ) ;
9294 } ) ;
9395 }
@@ -102,6 +104,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
102104 }
103105 this . _attachedBoards = event . newState . boards ;
104106 this . _availablePorts = event . newState . ports ;
107+ this . onAvailablePortsChangedEmitter . fire ( this . _availablePorts ) ;
105108 this . reconcileAvailableBoards ( ) . then ( ( ) => this . tryReconnect ( ) ) ;
106109 }
107110
@@ -601,8 +604,8 @@ export namespace AvailableBoard {
601604 return - 1 ;
602605 } else if ( left . port ?. protocol !== "network" && right . port ?. protocol === "network" ) {
603606 return 1 ;
604- } else if ( left . port ?. protocol === "serial" && right . port ?. protocol === "serial" ) {
605- // We show all serial ports, including those that have guessed
607+ } else if ( left . port ?. protocol === right . port ?. protocol ) {
608+ // We show all ports, including those that have guessed
606609 // or unrecognized boards, so we must sort those too.
607610 if ( left . state < right . state ) {
608611 return - 1 ;
0 commit comments