@@ -42,6 +42,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
42
42
protected readonly onAvailableBoardsChangedEmitter = new Emitter <
43
43
AvailableBoard [ ]
44
44
> ( ) ;
45
+ protected readonly onAvailablePortsChangedEmitter = new Emitter < Port [ ] > ( ) ;
45
46
46
47
/**
47
48
* 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 {
67
68
* This even also emitted when the board package for the currently selected board was uninstalled.
68
69
*/
69
70
readonly onBoardsConfigChanged = this . onBoardsConfigChangedEmitter . event ;
70
- readonly onAvailableBoardsChanged =
71
- this . onAvailableBoardsChangedEmitter . event ;
71
+ readonly onAvailableBoardsChanged = this . onAvailableBoardsChangedEmitter . event ;
72
+ readonly onAvailablePortsChanged = this . onAvailablePortsChangedEmitter . event ;
72
73
73
74
onStart ( ) : void {
74
75
this . notificationCenter . onAttachedBoardsChanged (
@@ -88,6 +89,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
88
89
] ) . then ( ( [ attachedBoards , availablePorts ] ) => {
89
90
this . _attachedBoards = attachedBoards ;
90
91
this . _availablePorts = availablePorts ;
92
+ this . onAvailablePortsChangedEmitter . fire ( this . _availablePorts ) ;
91
93
this . reconcileAvailableBoards ( ) . then ( ( ) => this . tryReconnect ( ) ) ;
92
94
} ) ;
93
95
}
@@ -102,6 +104,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
102
104
}
103
105
this . _attachedBoards = event . newState . boards ;
104
106
this . _availablePorts = event . newState . ports ;
107
+ this . onAvailablePortsChangedEmitter . fire ( this . _availablePorts ) ;
105
108
this . reconcileAvailableBoards ( ) . then ( ( ) => this . tryReconnect ( ) ) ;
106
109
}
107
110
@@ -601,8 +604,8 @@ export namespace AvailableBoard {
601
604
return - 1 ;
602
605
} else if ( left . port ?. protocol !== "network" && right . port ?. protocol === "network" ) {
603
606
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
606
609
// or unrecognized boards, so we must sort those too.
607
610
if ( left . state < right . state ) {
608
611
return - 1 ;
0 commit comments