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