-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional changes to allow PSReadLine to work in CLM #1290
Conversation
@@ -729,7 +729,7 @@ private async Task WritePromptStringToHostAsync(CancellationToken cancellationTo | |||
{ | |||
} | |||
|
|||
PSCommand promptCommand = new PSCommand().AddScript("prompt"); | |||
PSCommand promptCommand = new PSCommand().AddScript("prompt", useLocalScope: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If prompt
is usually dot-sourced in normal PowerShell, it might be worth adding a comment here. If this actually converts us to use normal behaviour, then no comment needed I imagine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How silly of me... prompt
is a function... so I switched to using AddCommand
:)
src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs
Show resolved
Hide resolved
$module = Get-Module -ListAvailable PSReadLine | | ||
Where-Object { $_.Version -gt '2.0.0' -or ($_.Version -eq '2.0.0' -and -not $_.PrivateData.PSData.Prerelease) } | | ||
Where-Object {{ $_.Version -ge '2.0.2' }} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth taking the version here out into a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that next time 😅 I really don't want to test on my SAW again lol
This is pending a 2.0.2 release of PSRL that has a fix for CLM.
On Windows PowerShell, for some reason... when PSReadLine is not a trusted module,
gmo -list
does not show it. As a workaround, we attempt to load PSRL from our module path.This ensures PSRL will be loaded when the PSRL feature is used.