File tree 1 file changed +3
-11
lines changed
src/PowerShellEditorServices/Services/PowerShellContext/Session
1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,6 @@ internal class PSReadLinePromptContext : IPromptContext
24
24
".." ,
25
25
"PSReadLine" ) ;
26
26
27
- // TODO: Does this have to be done in an inline script?
28
- private static readonly string ReadLineInitScript = $@ "
29
- [System.Diagnostics.DebuggerHidden()]
30
- [System.Diagnostics.DebuggerStepThrough()]
31
- param()
32
- end {{
33
- Import-Module '{ _psReadLineModulePath . Replace ( "'" , "''" ) } '
34
- return [Microsoft.PowerShell.PSConsoleReadLine]
35
- }}" ;
36
-
37
27
private static readonly Lazy < CmdletInfo > s_lazyInvokeReadLineForEditorServicesCmdletInfo = new Lazy < CmdletInfo > ( ( ) =>
38
28
{
39
29
var type = Type . GetType ( "Microsoft.PowerShell.EditorServices.Commands.InvokeReadLineForEditorServicesCommand, Microsoft.PowerShell.EditorServices.Hosting" ) ;
@@ -90,7 +80,9 @@ internal static bool TryGetPSReadLineProxy(
90
80
{
91
81
pwsh . Runspace = runspace ;
92
82
var psReadLineType = pwsh
93
- . AddScript ( ReadLineInitScript , useLocalScope : true )
83
+ . AddCommand ( "Microsoft.PowerShell.Core\\ Import-Module" )
84
+ . AddParameter ( "Name" , _psReadLineModulePath )
85
+ . AddCommand ( "return [Microsoft.PowerShell.PSConsoleReadLine]" )
94
86
. Invoke < Type > ( )
95
87
. FirstOrDefault ( ) ;
96
88
You can’t perform that action at this time.
0 commit comments