Skip to content

Commit 5331817

Browse files
committed
Fix InitialSessionState LanguageMode usage
1 parent d5c6900 commit 5331817

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs

+3-9
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public PowerShell CreateInitialPowerShell(
615615
HostStartupInfo hostStartupInfo,
616616
ReadLineProvider readLineProvider)
617617
{
618-
Runspace runspace = CreateInitialRunspace(hostStartupInfo.LanguageMode);
618+
Runspace runspace = CreateInitialRunspace(hostStartupInfo.InitialSessionState);
619619
PowerShell pwsh = CreatePowerShellForRunspace(runspace);
620620

621621
var engineIntrinsics = (EngineIntrinsics)runspace.SessionStateProxy.GetVariable("ExecutionContext");
@@ -650,15 +650,9 @@ public PowerShell CreateInitialPowerShell(
650650
return pwsh;
651651
}
652652

653-
private Runspace CreateInitialRunspace(PSLanguageMode languageMode)
653+
private Runspace CreateInitialRunspace(InitialSessionState initialSessionState)
654654
{
655-
InitialSessionState iss = Environment.GetEnvironmentVariable("PSES_TEST_USE_CREATE_DEFAULT") == "1"
656-
? InitialSessionState.CreateDefault()
657-
: InitialSessionState.CreateDefault2();
658-
659-
iss.LanguageMode = languageMode;
660-
661-
Runspace runspace = RunspaceFactory.CreateRunspace(PublicHost, iss);
655+
Runspace runspace = RunspaceFactory.CreateRunspace(PublicHost, initialSessionState);
662656

663657
runspace.SetApartmentStateToSta();
664658
runspace.ThreadOptions = PSThreadOptions.UseCurrentThread;

0 commit comments

Comments
 (0)