@@ -73,6 +73,9 @@ export type IReadSessionFileCallback = (details: IEditorServicesSessionDetails)
73
73
export const SendKeyPressNotificationType =
74
74
new NotificationType < void > ( "powerShell/sendKeyPress" ) ;
75
75
76
+ export const ExecutionBusyStatusNotificationType =
77
+ new NotificationType < boolean > ( "powerShell/executionBusyStatus" ) ;
78
+
76
79
export const PowerShellVersionRequestType =
77
80
new RequestType0 < IPowerShellVersionDetails , void > (
78
81
"powerShell/getVersion" ) ;
@@ -530,7 +533,7 @@ Type 'help' to get help.
530
533
this . languageServerProcess . onExited (
531
534
async ( ) => {
532
535
if ( this . sessionStatus === SessionStatus . Running ) {
533
- this . setSessionStatus ( "Session Exited" , SessionStatus . Failed ) ;
536
+ this . setSessionStatus ( "Session Exited! " , SessionStatus . Failed ) ;
534
537
await this . promptForRestart ( ) ;
535
538
}
536
539
} ) ;
@@ -658,6 +661,14 @@ Type 'help' to get help.
658
661
this . languageClient . onNotification (
659
662
SendKeyPressNotificationType ,
660
663
( ) => { this . languageServerProcess . sendKeyPress ( ) ; } ) ,
664
+
665
+ this . languageClient . onNotification (
666
+ ExecutionBusyStatusNotificationType ,
667
+ ( isBusy : boolean ) => {
668
+ if ( isBusy ) { this . setSessionBusyStatus ( ) ; }
669
+ else { this . setSessionRunningStatus ( ) ; }
670
+ }
671
+ ) ,
661
672
]
662
673
663
674
try {
@@ -668,7 +679,7 @@ Type 'help' to get help.
668
679
}
669
680
670
681
this . versionDetails = await this . languageClient . sendRequest ( PowerShellVersionRequestType ) ;
671
- this . setSessionRunningStatus ( ) ; // This requires the version details to be set.
682
+ this . setSessionRunningStatus ( ) ;
672
683
this . sendTelemetryEvent ( "powershellVersionCheck" , { powershellVersion : this . versionDetails . version } ) ;
673
684
674
685
// We haven't "started" until we're done getting the version information.
@@ -716,11 +727,26 @@ Type 'help' to get help.
716
727
this . languageStatusItem = vscode . languages . createLanguageStatusItem ( "powershell" , this . documentSelector ) ;
717
728
this . languageStatusItem . command = { title : statusTitle , command : this . ShowSessionMenuCommandName } ;
718
729
this . languageStatusItem . text = "$(terminal-powershell)" ;
730
+ this . languageStatusItem . detail = "PowerShell" ;
719
731
}
720
732
721
733
private setSessionStatus ( statusText : string , status : SessionStatus ) : void {
722
734
this . sessionStatus = status ;
723
- this . languageStatusItem . detail = "PowerShell " + statusText ;
735
+ this . languageStatusItem . detail = "PowerShell" ;
736
+
737
+ if ( this . versionDetails !== undefined ) {
738
+ const version = this . versionDetails . architecture === "x86"
739
+ ? `${ this . versionDetails . displayVersion } (${ this . versionDetails . architecture } )`
740
+ : this . versionDetails . displayVersion ;
741
+
742
+ this . languageStatusItem . text = "$(terminal-powershell) " + version ;
743
+ this . languageStatusItem . detail += " " + version ;
744
+ }
745
+
746
+ if ( statusText ) {
747
+ this . languageStatusItem . detail += ": " + statusText ;
748
+ }
749
+
724
750
switch ( status ) {
725
751
case SessionStatus . Running :
726
752
case SessionStatus . NeverStarted :
@@ -745,21 +771,16 @@ Type 'help' to get help.
745
771
746
772
}
747
773
748
- public setSessionRunningStatus ( ) : void {
749
- const version = this . versionDetails . architecture === "x86"
750
- ? `${ this . versionDetails . displayVersion } (${ this . versionDetails . architecture } )`
751
- : this . versionDetails . displayVersion ;
752
-
753
- this . languageStatusItem . text = "$(terminal-powershell) " + version ;
754
- this . setSessionStatus ( version , SessionStatus . Running ) ;
774
+ private setSessionRunningStatus ( ) : void {
775
+ this . setSessionStatus ( "" , SessionStatus . Running ) ;
755
776
}
756
777
757
- public setSessionBusyStatus ( ) : void {
778
+ private setSessionBusyStatus ( ) : void {
758
779
this . setSessionStatus ( "Executing..." , SessionStatus . Busy ) ;
759
780
}
760
781
761
782
private async setSessionFailure ( message : string , ...additionalMessages : string [ ] ) {
762
- this . setSessionStatus ( "Initialization Error" , SessionStatus . Failed ) ;
783
+ this . setSessionStatus ( "Initialization Error! " , SessionStatus . Failed ) ;
763
784
await this . log . writeAndShowError ( message , ...additionalMessages ) ;
764
785
}
765
786
0 commit comments