@@ -33,6 +33,7 @@ export enum SessionStatus {
3333 NotStarted ,
3434 Initializing ,
3535 Running ,
36+ Busy ,
3637 Stopping ,
3738 Failed ,
3839}
@@ -76,10 +77,6 @@ export const PowerShellVersionRequestType =
7677 new RequestType0 < IPowerShellVersionDetails , void > (
7778 "powerShell/getVersion" ) ;
7879
79- export const RunspaceChangedEventType =
80- new NotificationType < IRunspaceDetails > (
81- "powerShell/runspaceChanged" ) ;
82-
8380export class SessionManager implements Middleware {
8481 public HostName : string ;
8582 public HostVersion : string ;
@@ -502,21 +499,6 @@ Type 'help' to get help.
502499 }
503500 }
504501
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-
520502 private registerCommands ( ) : void {
521503 this . registeredCommands = [
522504 vscode . commands . registerCommand ( "PowerShell.RestartSession" , async ( ) => { await this . restartSession ( ) ; } ) ,
@@ -676,11 +658,6 @@ Type 'help' to get help.
676658 this . languageClient . onNotification (
677659 SendKeyPressNotificationType ,
678660 ( ) => { 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 ) ; } ) ,
684661 ]
685662
686663 try {
@@ -691,13 +668,9 @@ Type 'help' to get help.
691668 }
692669
693670 this . versionDetails = await this . languageClient . sendRequest ( PowerShellVersionRequestType ) ;
694-
671+ this . setSessionRunningStatus ( ) ; // This requires the version details to be set.
695672 this . sendTelemetryEvent ( "powershellVersionCheck" , { powershellVersion : this . versionDetails . version } ) ;
696673
697- this . setSessionVersion ( this . versionDetails . architecture === "x86"
698- ? `${ this . versionDetails . displayVersion } (${ this . versionDetails . architecture } )`
699- : this . versionDetails . displayVersion ) ;
700-
701674 // We haven't "started" until we're done getting the version information.
702675 this . started = true ;
703676
@@ -753,30 +726,38 @@ Type 'help' to get help.
753726 case SessionStatus . NeverStarted :
754727 case SessionStatus . NotStarted :
755728 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 ;
757733 this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Information ;
758734 break ;
759735 case SessionStatus . Initializing :
760736 case SessionStatus . Stopping :
761737 this . languageStatusItem . busy = true ;
762- // @ts -ignore
763738 this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Warning ;
764739 break ;
765740 case SessionStatus . Failed :
766741 this . languageStatusItem . busy = false ;
767- // @ts -ignore
768742 this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Error ;
769743 break ;
770744 }
771745
772746 }
773747
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+
776753 this . languageStatusItem . text = "$(terminal-powershell) " + version ;
777754 this . setSessionStatus ( version , SessionStatus . Running ) ;
778755 }
779756
757+ public setSessionBusyStatus ( ) : void {
758+ this . setSessionStatus ( "Executing..." , SessionStatus . Busy ) ;
759+ }
760+
780761 private async setSessionFailure ( message : string , ...additionalMessages : string [ ] ) {
781762 this . setSessionStatus ( "Initialization Error" , SessionStatus . Failed ) ;
782763 await this . log . writeAndShowError ( message , ...additionalMessages ) ;
0 commit comments