@@ -73,6 +73,9 @@ export type IReadSessionFileCallback = (details: IEditorServicesSessionDetails)
7373export const SendKeyPressNotificationType =
7474 new NotificationType < void > ( "powerShell/sendKeyPress" ) ;
7575
76+ export const ExecutionBusyStatusNotificationType =
77+ new NotificationType < boolean > ( "powerShell/executionBusyStatus" ) ;
78+
7679export const PowerShellVersionRequestType =
7780 new RequestType0 < IPowerShellVersionDetails , void > (
7881 "powerShell/getVersion" ) ;
@@ -530,7 +533,7 @@ Type 'help' to get help.
530533 this . languageServerProcess . onExited (
531534 async ( ) => {
532535 if ( this . sessionStatus === SessionStatus . Running ) {
533- this . setSessionStatus ( "Session Exited" , SessionStatus . Failed ) ;
536+ this . setSessionStatus ( "Session Exited! " , SessionStatus . Failed ) ;
534537 await this . promptForRestart ( ) ;
535538 }
536539 } ) ;
@@ -658,6 +661,14 @@ Type 'help' to get help.
658661 this . languageClient . onNotification (
659662 SendKeyPressNotificationType ,
660663 ( ) => { this . languageServerProcess . sendKeyPress ( ) ; } ) ,
664+
665+ this . languageClient . onNotification (
666+ ExecutionBusyStatusNotificationType ,
667+ ( isBusy : boolean ) => {
668+ if ( isBusy ) { this . setSessionBusyStatus ( ) ; }
669+ else { this . setSessionRunningStatus ( ) ; }
670+ }
671+ ) ,
661672 ]
662673
663674 try {
@@ -668,7 +679,7 @@ Type 'help' to get help.
668679 }
669680
670681 this . versionDetails = await this . languageClient . sendRequest ( PowerShellVersionRequestType ) ;
671- this . setSessionRunningStatus ( ) ; // This requires the version details to be set.
682+ this . setSessionRunningStatus ( ) ;
672683 this . sendTelemetryEvent ( "powershellVersionCheck" , { powershellVersion : this . versionDetails . version } ) ;
673684
674685 // We haven't "started" until we're done getting the version information.
@@ -716,11 +727,26 @@ Type 'help' to get help.
716727 this . languageStatusItem = vscode . languages . createLanguageStatusItem ( "powershell" , this . documentSelector ) ;
717728 this . languageStatusItem . command = { title : statusTitle , command : this . ShowSessionMenuCommandName } ;
718729 this . languageStatusItem . text = "$(terminal-powershell)" ;
730+ this . languageStatusItem . detail = "PowerShell" ;
719731 }
720732
721733 private setSessionStatus ( statusText : string , status : SessionStatus ) : void {
722734 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+
724750 switch ( status ) {
725751 case SessionStatus . Running :
726752 case SessionStatus . NeverStarted :
@@ -745,21 +771,16 @@ Type 'help' to get help.
745771
746772 }
747773
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 ) ;
755776 }
756777
757- public setSessionBusyStatus ( ) : void {
778+ private setSessionBusyStatus ( ) : void {
758779 this . setSessionStatus ( "Executing..." , SessionStatus . Busy ) ;
759780 }
760781
761782 private async setSessionFailure ( message : string , ...additionalMessages : string [ ] ) {
762- this . setSessionStatus ( "Initialization Error" , SessionStatus . Failed ) ;
783+ this . setSessionStatus ( "Initialization Error! " , SessionStatus . Failed ) ;
763784 await this . log . writeAndShowError ( message , ...additionalMessages ) ;
764785 }
765786
0 commit comments