@@ -91,9 +91,7 @@ export class SessionManager implements Middleware {
9191 private focusConsoleOnExecute : boolean ;
9292 private platformDetails : IPlatformDetails ;
9393 private languageClientConsumers : LanguageClientConsumer [ ] = [ ] ;
94- // @ts -ignore TODO: Don't ignore after we update our engine.
9594 private languageStatusItem : vscode . LanguageStatusItem ;
96- private statusBarItem : vscode . StatusBarItem ;
9795 private languageServerProcess : PowerShellProcess ;
9896 private debugSessionProcess : PowerShellProcess ;
9997 private debugEventHandler : vscode . Disposable ;
@@ -710,90 +708,43 @@ Type 'help' to get help.
710708
711709 private createStatusBarItem ( ) {
712710 const statusTitle : string = "Show PowerShell Session Menu" ;
713- // TODO: Remove old status bar logic when we update our engine.
714- if ( semver . gte ( vscode . version , "1.65.0" ) && this . languageStatusItem === undefined ) {
715- // @ts -ignore
716- this . languageStatusItem = vscode . languages . createLanguageStatusItem ( "powershell" , this . documentSelector ) ;
717- this . languageStatusItem . command = { title : statusTitle , command : this . ShowSessionMenuCommandName } ;
718- this . languageStatusItem . text = "$(terminal-powershell)" ;
719- } else if ( this . statusBarItem === undefined ) {
720- // Create the status bar item and place it right next
721- // to the language indicator
722- this . statusBarItem =
723- vscode . window . createStatusBarItem (
724- vscode . StatusBarAlignment . Right ,
725- 1 ) ;
726-
727- this . statusBarItem . command = this . ShowSessionMenuCommandName ;
728- this . statusBarItem . tooltip = statusTitle ;
729- this . statusBarItem . show ( ) ;
730- vscode . window . onDidChangeActiveTextEditor ( ( textEditor ) => {
731- if ( textEditor === undefined
732- || textEditor . document . languageId !== "powershell" ) {
733- this . statusBarItem . hide ( ) ;
734- } else {
735- this . statusBarItem . show ( ) ;
736- }
737- } ) ;
711+ if ( this . languageStatusItem !== undefined ) {
712+ return ;
738713 }
714+ this . languageStatusItem = vscode . languages . createLanguageStatusItem ( "powershell" , this . documentSelector ) ;
715+ this . languageStatusItem . command = { title : statusTitle , command : this . ShowSessionMenuCommandName } ;
716+ this . languageStatusItem . text = "$(terminal-powershell)" ;
739717 }
740718
741719 private setSessionStatus ( statusText : string , status : SessionStatus ) : void {
742720 this . sessionStatus = status ;
743- // TODO: Remove old status bar logic when we update our engine.
744- if ( semver . gte ( vscode . version , "1.65.0" ) ) {
745- this . languageStatusItem . detail = "PowerShell " + statusText ;
746- switch ( status ) {
747- case SessionStatus . Running :
748- case SessionStatus . NeverStarted :
749- case SessionStatus . NotStarted :
750- this . languageStatusItem . busy = false ;
751- // @ts -ignore
752- this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Information ;
753- break ;
754- case SessionStatus . Initializing :
755- case SessionStatus . Stopping :
756- this . languageStatusItem . busy = true ;
757- // @ts -ignore
758- this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Warning ;
759- break ;
760- case SessionStatus . Failed :
761- this . languageStatusItem . busy = false ;
762- // @ts -ignore
763- this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Error ;
764- break ;
765- }
766- } else {
767- switch ( status ) {
768- case SessionStatus . Running :
769- case SessionStatus . NeverStarted :
770- case SessionStatus . NotStarted :
771- this . statusBarItem . text = "$(terminal-powershell)" ;
772- // These have to be reset because this function mutates state.
773- this . statusBarItem . color = undefined ;
774- this . statusBarItem . backgroundColor = undefined ;
775- break ;
776- case SessionStatus . Initializing :
777- case SessionStatus . Stopping :
778- this . statusBarItem . text = "$(sync)" ;
779- this . statusBarItem . color = new vscode . ThemeColor ( "statusBarItem.warningForeground" ) ;
780- this . statusBarItem . backgroundColor = new vscode . ThemeColor ( "statusBarItem.warningBackground" ) ;
781- break ;
782- case SessionStatus . Failed :
783- this . statusBarItem . text = "$(alert)" ;
784- this . statusBarItem . color = new vscode . ThemeColor ( "statusBarItem.errorForeground" ) ;
785- this . statusBarItem . backgroundColor = new vscode . ThemeColor ( "statusBarItem.errorBackground" ) ;
786- break ;
787- }
788- this . statusBarItem . text += " " + statusText ;
721+ this . languageStatusItem . detail = "PowerShell " + statusText ;
722+ switch ( status ) {
723+ case SessionStatus . Running :
724+ case SessionStatus . NeverStarted :
725+ case SessionStatus . NotStarted :
726+ this . languageStatusItem . busy = false ;
727+ // @ts -ignore
728+ this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Information ;
729+ break ;
730+ case SessionStatus . Initializing :
731+ case SessionStatus . Stopping :
732+ this . languageStatusItem . busy = true ;
733+ // @ts -ignore
734+ this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Warning ;
735+ break ;
736+ case SessionStatus . Failed :
737+ this . languageStatusItem . busy = false ;
738+ // @ts -ignore
739+ this . languageStatusItem . severity = vscode . LanguageStatusSeverity . Error ;
740+ break ;
789741 }
742+
790743 }
791744
792745 private setSessionVersion ( version : string ) : void {
793746 // TODO: Accept a VersionDetails object instead of a string.
794- if ( semver . gte ( vscode . version , "1.65.0" ) ) {
795- this . languageStatusItem . text = "$(terminal-powershell) " + version ;
796- }
747+ this . languageStatusItem . text = "$(terminal-powershell) " + version ;
797748 this . setSessionStatus ( version , SessionStatus . Running ) ;
798749 }
799750
0 commit comments