@@ -437,7 +437,7 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
437
437
}
438
438
439
439
private renderRemoteStatusIndicator ( initialText : string , initialTooltip ?: string | MarkdownString , command ?: string , showProgress ?: boolean ) : void {
440
- const { text, tooltip, ariaLabel } = this . withNetworkStatus ( initialText , initialTooltip ) ;
440
+ const { text, tooltip, ariaLabel } = this . withNetworkStatus ( initialText , initialTooltip , showProgress ) ;
441
441
442
442
const properties : IStatusbarEntry = {
443
443
name : nls . localize ( 'remoteHost' , "Remote Host" ) ,
@@ -457,35 +457,37 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
457
457
}
458
458
}
459
459
460
- private withNetworkStatus ( initialText : string , initialTooltip ?: string | MarkdownString ) : { text : string ; tooltip : string | IMarkdownString | undefined ; ariaLabel : string } {
460
+ private withNetworkStatus ( initialText : string , initialTooltip ?: string | MarkdownString , showProgress ?: boolean ) : { text : string ; tooltip : string | IMarkdownString | undefined ; ariaLabel : string } {
461
461
let text = initialText ;
462
462
let tooltip = initialTooltip ;
463
463
let ariaLabel = getCodiconAriaLabel ( text ) ;
464
464
465
- // `initialText` can have a "$(remote)" codicon in the beginning
466
- // but it may not have it depending on the environment.
467
- // the following function will replace the codicon in the beginning with
468
- // another icon or add it to the beginning if no icon
465
+ function textWithAlert ( ) : string {
469
466
470
- function insertOrReplaceCodicon ( target : string , codicon : string ) : string {
471
- if ( target . startsWith ( '$(remote)' ) ) {
472
- return target . replace ( '$(remote)' , codicon ) ;
467
+ // `initialText` can have a codicon in the beginning that already
468
+ // indicates some kind of status, or we may have been asked to
469
+ // show progress, where a spinning codicon appears. we only want
470
+ // to replace with an alert icon for when a normal remote indicator
471
+ // is shown.
472
+
473
+ if ( ! showProgress && initialText . startsWith ( '$(remote)' ) ) {
474
+ return initialText . replace ( '$(remote)' , '$(alert)' ) ;
473
475
}
474
476
475
- return ` ${ codicon } ${ target } ` ;
477
+ return initialText ;
476
478
}
477
479
478
480
switch ( this . networkState ) {
479
481
case 'offline' : {
480
- text = insertOrReplaceCodicon ( initialText , '$(alert)' ) ;
481
-
482
482
const offlineMessage = nls . localize ( 'networkStatusOfflineTooltip' , "Network appears to be offline, certain features might be unavailable." ) ;
483
+
484
+ text = textWithAlert ( ) ;
483
485
tooltip = this . appendTooltipLine ( tooltip , offlineMessage ) ;
484
486
ariaLabel = `${ ariaLabel } , ${ offlineMessage } ` ;
485
487
break ;
486
488
}
487
489
case 'high-latency' :
488
- text = insertOrReplaceCodicon ( initialText , '$(alert)' ) ;
490
+ text = textWithAlert ( ) ;
489
491
tooltip = this . appendTooltipLine ( tooltip , nls . localize ( 'networkStatusHighLatencyTooltip' , "Network appears to have high latency ({0}ms last, {1}ms average), certain features may be slow to respond." , remoteConnectionLatencyMeasurer . latency ?. current ?. toFixed ( 2 ) , remoteConnectionLatencyMeasurer . latency ?. average ?. toFixed ( 2 ) ) ) ;
490
492
break ;
491
493
}
0 commit comments