@@ -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 ;
@@ -710,90 +708,43 @@ Type 'help' to get help.
710
708
711
709
private createStatusBarItem ( ) {
712
710
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 ;
738
713
}
714
+ this . languageStatusItem = vscode . languages . createLanguageStatusItem ( "powershell" , this . documentSelector ) ;
715
+ this . languageStatusItem . command = { title : statusTitle , command : this . ShowSessionMenuCommandName } ;
716
+ this . languageStatusItem . text = "$(terminal-powershell)" ;
739
717
}
740
718
741
719
private setSessionStatus ( statusText : string , status : SessionStatus ) : void {
742
720
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 ;
789
741
}
742
+
790
743
}
791
744
792
745
private setSessionVersion ( version : string ) : void {
793
746
// 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 ;
797
748
this . setSessionStatus ( version , SessionStatus . Running ) ;
798
749
}
799
750
0 commit comments