@@ -66,7 +66,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
66
66
protected _availableBoards : AvailableBoard [ ] = [ ] ;
67
67
68
68
private lastBoardsConfigOnUpload : BoardsConfig . Config | undefined ;
69
- private boardConfigToSelect : BoardsConfig . Config | undefined ;
69
+ private boardConfigToAutoSelect : BoardsConfig . Config | undefined ;
70
70
71
71
/**
72
72
* Unlike `onAttachedBoardsChanged` this even fires when the user modifies the selected board in the IDE.\
@@ -120,9 +120,11 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
120
120
this . lastBoardsConfigOnUpload = value ;
121
121
}
122
122
123
- private derivePersistingUploadPort ( event : AttachedBoardsChangeEvent ) : void {
123
+ private deriveBoardConfigToAutoSelect (
124
+ event : AttachedBoardsChangeEvent
125
+ ) : void {
124
126
if ( ! this . lastBoardsConfigOnUpload ) {
125
- this . boardConfigToSelect = undefined ;
127
+ this . boardConfigToAutoSelect = undefined ;
126
128
return ;
127
129
}
128
130
@@ -142,18 +144,20 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
142
144
const lastSelectionOnUpload = this . lastBoardsConfigOnUpload ;
143
145
this . setLastBoardsConfigOnUpload ( undefined ) ;
144
146
147
+ const appearedPort = appearedPorts [ 0 ] ;
148
+
145
149
const boardOnAppearedPort = newBoards . find ( ( board : Board ) =>
146
- Port . sameAs ( board . port , appearedPorts [ 0 ] )
150
+ Port . sameAs ( board . port , appearedPort )
147
151
) ;
148
152
149
153
if (
150
154
boardOnAppearedPort &&
151
155
lastSelectionOnUpload . selectedBoard &&
152
156
Board . sameAs ( boardOnAppearedPort , lastSelectionOnUpload . selectedBoard )
153
157
) {
154
- this . boardConfigToSelect = {
158
+ this . boardConfigToAutoSelect = {
155
159
selectedBoard : boardOnAppearedPort ,
156
- selectedPort : appearedPorts [ 0 ] ,
160
+ selectedPort : appearedPort ,
157
161
} ;
158
162
return ;
159
163
}
@@ -172,7 +176,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
172
176
const { uploadInProgress } = event ;
173
177
174
178
if ( ! uploadInProgress ) {
175
- this . derivePersistingUploadPort ( event ) ;
179
+ this . deriveBoardConfigToAutoSelect ( event ) ;
176
180
}
177
181
178
182
this . _attachedBoards = event . newState . boards ;
@@ -299,10 +303,10 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
299
303
}
300
304
}
301
305
302
- if ( ! this . boardConfigToSelect ) return false ;
306
+ if ( ! this . boardConfigToAutoSelect ) return false ;
303
307
304
- this . boardsConfig = this . boardConfigToSelect ;
305
- this . boardConfigToSelect = undefined ;
308
+ this . boardsConfig = this . boardConfigToAutoSelect ;
309
+ this . boardConfigToAutoSelect = undefined ;
306
310
return true ;
307
311
}
308
312
return false ;
0 commit comments