File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
src/PowerShellEditorServices/Services/PowerShellContext/Session Expand file tree Collapse file tree 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
2424 ".." ,
2525 "PSReadLine" ) ;
2626
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-
3727 private static readonly Lazy < CmdletInfo > s_lazyInvokeReadLineForEditorServicesCmdletInfo = new Lazy < CmdletInfo > ( ( ) =>
3828 {
3929 var type = Type . GetType ( "Microsoft.PowerShell.EditorServices.Commands.InvokeReadLineForEditorServicesCommand, Microsoft.PowerShell.EditorServices.Hosting" ) ;
@@ -90,7 +80,9 @@ internal static bool TryGetPSReadLineProxy(
9080 {
9181 pwsh . Runspace = runspace ;
9282 var psReadLineType = pwsh
93- . AddScript ( ReadLineInitScript , useLocalScope : true )
83+ . AddCommand ( "Import-Module" )
84+ . AddParameter ( "Name" , _psReadLineModulePath . Replace ( "'" , "''" ) )
85+ . AddParameter ( "PassThru" )
9486 . Invoke < Type > ( )
9587 . FirstOrDefault ( ) ;
9688
You can’t perform that action at this time.
0 commit comments