@@ -33,6 +33,7 @@ export enum SessionStatus {
33
33
NotStarted ,
34
34
Initializing ,
35
35
Running ,
36
+ Busy ,
36
37
Stopping ,
37
38
Failed ,
38
39
}
@@ -76,10 +77,6 @@ export const PowerShellVersionRequestType =
76
77
new RequestType0 < IPowerShellVersionDetails , void > (
77
78
"powerShell/getVersion" ) ;
78
79
79
- export const RunspaceChangedEventType =
80
- new NotificationType < IRunspaceDetails > (
81
- "powerShell/runspaceChanged" ) ;
82
-
83
80
export class SessionManager implements Middleware {
84
81
public HostName : string ;
85
82
public HostVersion : string ;
@@ -502,21 +499,6 @@ Type 'help' to get help.
502
499
}
503
500
}
504
501
505
- private setStatusBarVersionString ( runspaceDetails : IRunspaceDetails ) {
506
- const psVersion = runspaceDetails . powerShellVersion ;
507
-
508
- let versionString =
509
- this . versionDetails . architecture === "x86"
510
- ? `${ psVersion . displayVersion } (${ psVersion . architecture } )`
511
- : psVersion . displayVersion ;
512
-
513
- if ( runspaceDetails . runspaceType !== RunspaceType . Local ) {
514
- versionString += ` [${ runspaceDetails . connectionString } ]` ;
515
- }
516
-
517
- this . setSessionVersion ( versionString ) ;
518
- }
519
-
520
502
private registerCommands ( ) : void {
521
503
this . registeredCommands = [
522
504
vscode . commands . registerCommand ( "PowerShell.RestartSession" , async ( ) => { await this . restartSession ( ) ; } ) ,
@@ -676,11 +658,6 @@ Type 'help' to get help.
676
658
this . languageClient . onNotification (
677
659
SendKeyPressNotificationType ,
678
660
( ) => { this . languageServerProcess . sendKeyPress ( ) ; } ) ,
679
-
680
- // TODO: I'm not sure we're still receiving these notifications...
681
- this . languageClient . onNotification (
682
- RunspaceChangedEventType ,
683
- ( runspaceDetails ) => { this . setStatusBarVersionString ( runspaceDetails ) ; } ) ,
684
661
]
685
662
686
663
try {
@@ -691,13 +668,9 @@ Type 'help' to get help.
691
668
}
692
669
693
670
this . versionDetails = await this . languageClient . sendRequest ( PowerShellVersionRequestType ) ;
694
-
671
+ this . setSessionRunningStatus ( ) ; // This requires the version details to be set.
695
672
this . sendTelemetryEvent ( "powershellVersionCheck" , { powershellVersion : this . versionDetails . version } ) ;
696
673
697
- this . setSessionVersion ( this . versionDetails . architecture === "x86"
698
- ? `${ this . versionDetails . displayVersion } (${ this . versionDetails . architecture } )`
699
- : this . versionDetails . displayVersion ) ;
700
-
701
674
// We haven't "started" until we're done getting the version information.
702
675
this . started = true ;
703
676
@@ -753,30 +726,38 @@ Type 'help' to get help.
753
726
case SessionStatus . NeverStarted :
754
727
case SessionStatus . NotStarted :
755
728
this . languageStatusItem . busy = false ;
756
- // @ts -ignore
729
+ this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Information ;
730
+ break ;
731
+ case SessionStatus . Busy :
732
+ this . languageStatusItem . busy = true ;
757
733
this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Information ;
758
734
break ;
759
735
case SessionStatus . Initializing :
760
736
case SessionStatus . Stopping :
761
737
this . languageStatusItem . busy = true ;
762
- // @ts -ignore
763
738
this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Warning ;
764
739
break ;
765
740
case SessionStatus . Failed :
766
741
this . languageStatusItem . busy = false ;
767
- // @ts -ignore
768
742
this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Error ;
769
743
break ;
770
744
}
771
745
772
746
}
773
747
774
- private setSessionVersion ( version : string ) : void {
775
- // TODO: Accept a VersionDetails object instead of a string.
748
+ public setSessionRunningStatus ( ) : void {
749
+ const version = this . versionDetails . architecture === "x86"
750
+ ? `${ this . versionDetails . displayVersion } (${ this . versionDetails . architecture } )`
751
+ : this . versionDetails . displayVersion ;
752
+
776
753
this . languageStatusItem . text = "$(terminal-powershell) " + version ;
777
754
this . setSessionStatus ( version , SessionStatus . Running ) ;
778
755
}
779
756
757
+ public setSessionBusyStatus ( ) : void {
758
+ this . setSessionStatus ( "Executing..." , SessionStatus . Busy ) ;
759
+ }
760
+
780
761
private async setSessionFailure ( message : string , ...additionalMessages : string [ ] ) {
781
762
this . setSessionStatus ( "Initialization Error" , SessionStatus . Failed ) ;
782
763
await this . log . writeAndShowError ( message , ...additionalMessages ) ;
0 commit comments