@@ -185,8 +185,8 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
185
185
const selectedAvailableBoard = AvailableBoard . is ( selectedBoard )
186
186
? selectedBoard
187
187
: this . _availableBoards . find ( ( availableBoard ) =>
188
- Board . sameAs ( availableBoard , selectedBoard )
189
- ) ;
188
+ Board . sameAs ( availableBoard , selectedBoard )
189
+ ) ;
190
190
if (
191
191
selectedAvailableBoard &&
192
192
selectedAvailableBoard . selected &&
@@ -244,7 +244,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
244
244
}
245
245
246
246
set boardsConfig ( config : BoardsConfig . Config ) {
247
- this . doSetBoardsConfig ( config ) ;
247
+ this . setBoardsConfig ( config ) ;
248
248
this . saveState ( ) . finally ( ( ) =>
249
249
this . reconcileAvailableBoards ( ) . finally ( ( ) =>
250
250
this . onBoardsConfigChangedEmitter . fire ( this . _boardsConfig )
@@ -256,7 +256,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
256
256
return this . _boardsConfig ;
257
257
}
258
258
259
- protected doSetBoardsConfig ( config : BoardsConfig . Config ) : void {
259
+ protected setBoardsConfig ( config : BoardsConfig . Config ) : void {
260
260
this . logger . info ( 'Board config changed: ' , JSON . stringify ( config ) ) ;
261
261
this . _boardsConfig = config ;
262
262
this . latestBoardsConfig = this . _boardsConfig ;
@@ -370,19 +370,19 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
370
370
const find = ( needle : Board & { port : Port } , haystack : AvailableBoard [ ] ) =>
371
371
haystack . find (
372
372
( board ) =>
373
- Board . equals ( needle , board ) && Port . equals ( needle . port , board . port )
373
+ Board . equals ( needle , board ) && Port . sameAs ( needle . port , board . port )
374
374
) ;
375
375
const timeoutTask =
376
376
! ! timeout && timeout > 0
377
377
? new Promise < void > ( ( _ , reject ) =>
378
- setTimeout (
379
- ( ) => reject ( new Error ( `Timeout after ${ timeout } ms.` ) ) ,
380
- timeout
381
- )
378
+ setTimeout (
379
+ ( ) => reject ( new Error ( `Timeout after ${ timeout } ms.` ) ) ,
380
+ timeout
382
381
)
382
+ )
383
383
: new Promise < void > ( ( ) => {
384
- /* never */
385
- } ) ;
384
+ /* never */
385
+ } ) ;
386
386
const waitUntilTask = new Promise < void > ( ( resolve ) => {
387
387
let candidate = find ( what , this . availableBoards ) ;
388
388
if ( candidate ) {
@@ -409,7 +409,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
409
409
Port . sameAs ( port , this . boardsConfig . selectedPort )
410
410
)
411
411
) {
412
- this . doSetBoardsConfig ( {
412
+ this . setBoardsConfig ( {
413
413
selectedBoard : this . boardsConfig . selectedBoard ,
414
414
selectedPort : undefined ,
415
415
} ) ;
@@ -533,9 +533,8 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
533
533
534
534
protected getLastSelectedBoardOnPortKey ( port : Port | string ) : string {
535
535
// TODO: we lose the port's `protocol` info (`serial`, `network`, etc.) here if the `port` is a `string`.
536
- return `last-selected-board-on-port:${
537
- typeof port === 'string' ? port : Port . toString ( port )
538
- } `;
536
+ return `last-selected-board-on-port:${ typeof port === 'string' ? port : port . address
537
+ } `;
539
538
}
540
539
541
540
protected async loadState ( ) : Promise < void > {
0 commit comments