@@ -44,7 +44,6 @@ export enum RunspaceType {
44
44
export interface IEditorServicesSessionDetails {
45
45
status : string ;
46
46
reason : string ;
47
- detail : string ;
48
47
powerShellVersion : string ;
49
48
channel : string ;
50
49
languageServicePort : number ;
@@ -430,7 +429,7 @@ export class SessionManager implements Middleware {
430
429
431
430
private async startPowerShell ( ) : Promise < PowerShellProcess | undefined > {
432
431
if ( this . PowerShellExeDetails === undefined ) {
433
- this . setSessionFailure ( "Unable to find PowerShell. " ) ;
432
+ void this . setSessionFailedGetPowerShell ( "Unable to find PowerShell, try installing it? " ) ;
434
433
return ;
435
434
}
436
435
@@ -498,10 +497,10 @@ export class SessionManager implements Middleware {
498
497
void this . setSessionFailedOpenBug ( "Language client failed to start: " + ( err instanceof Error ? err . message : "unknown" ) ) ;
499
498
}
500
499
} else if ( this . sessionDetails . status === "failed" ) { // Server started but indicated it failed
501
- if ( this . sessionDetails . reason === "unsupported " ) {
500
+ if ( this . sessionDetails . reason === "powerShellVersion " ) {
502
501
void this . setSessionFailedGetPowerShell ( `PowerShell ${ this . sessionDetails . powerShellVersion } is not supported, please update!` ) ;
503
- } else if ( this . sessionDetails . reason === "languageMode " ) {
504
- this . setSessionFailure ( `PowerShell language features are disabled due to an unsupported LanguageMode: ${ this . sessionDetails . detail } ` ) ;
502
+ } else if ( this . sessionDetails . reason === "dotNetVersion " ) { // Only applies to PowerShell 5.1
503
+ void this . setSessionFailedGetDotNet ( ".NET Framework is out-of-date, please install at least 4.8!" ) ;
505
504
} else {
506
505
void this . setSessionFailedOpenBug ( `PowerShell could not be started for an unknown reason: ${ this . sessionDetails . reason } ` ) ;
507
506
}
@@ -728,7 +727,7 @@ Type 'help' to get help.
728
727
try {
729
728
await this . languageClient . start ( ) ;
730
729
} catch ( err ) {
731
- this . setSessionFailure ( "Could not start language service: " , err instanceof Error ? err . message : "unknown" ) ;
730
+ void this . setSessionFailedOpenBug ( "Could not start language service: " + ( err instanceof Error ? err . message : "unknown" ) ) ;
732
731
return ;
733
732
}
734
733
@@ -799,11 +798,6 @@ Type 'help' to get help.
799
798
this . setSessionStatus ( "Executing..." , SessionStatus . Busy ) ;
800
799
}
801
800
802
- private setSessionFailure ( message : string , ...additionalMessages : string [ ] ) : void {
803
- this . setSessionStatus ( "Initialization Error!" , SessionStatus . Failed ) ;
804
- void this . logger . writeAndShowError ( message , ...additionalMessages ) ;
805
- }
806
-
807
801
private async setSessionFailedOpenBug ( message : string ) : Promise < void > {
808
802
this . setSessionStatus ( "Initialization Error!" , SessionStatus . Failed ) ;
809
803
await this . logger . writeAndShowErrorWithActions ( message , [ {
@@ -825,6 +819,17 @@ Type 'help' to get help.
825
819
) ;
826
820
}
827
821
822
+ private async setSessionFailedGetDotNet ( message : string ) : Promise < void > {
823
+ this . setSessionStatus ( "Initialization Error!" , SessionStatus . Failed ) ;
824
+ await this . logger . writeAndShowErrorWithActions ( message , [ {
825
+ prompt : "Open .NET Framework Documentation" ,
826
+ action : async ( ) : Promise < void > => {
827
+ await vscode . env . openExternal (
828
+ vscode . Uri . parse ( "https://dotnet.microsoft.com/en-us/download/dotnet-framework" ) ) ;
829
+ } } ]
830
+ ) ;
831
+ }
832
+
828
833
private async changePowerShellDefaultVersion ( exePath : IPowerShellExeDetails ) : Promise < void > {
829
834
this . suppressRestartPrompt = true ;
830
835
try {
0 commit comments