-
Notifications
You must be signed in to change notification settings - Fork 304
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
PSReadLine doesn't work with ISE #401
Comments
PSReadLine doesn't support the ISE which doesn't have a true console (conhost.exe) behind it. Checking for the host is to prevent loading in the ISE. |
Thanks @gwojan. Is there any way psreadline could work with what ISE provides, or should I find a different way to handle persistent history? |
There are a number of things you could do. There is a module called You could also configure your When I have my work machine available I can send you the commands I use to configure the the |
@mikemaccana Try adding this to your profile: $historyPath = "$env:USERPROFILE\PowerShell_History.xml"
if (Test-Path -Path $historyPath) {
Add-History (Import-Clixml $historyPath)
}
else {
Write-Warning "$historyPath does not exist. Unable to restore command history"
}
Register-EngineEvent -SupportEvent PowerShell.Exiting -Action { Get-History | Export-Clixml -Path $historyPath -Encoding ASCII} Now every time you type Sadly, the PowerShell console is not an application that responds to Windows shutdown notifications so the event handler doesn't execute on Windows shutdown and I've never really experimented with the ISE because I almost never use it. |
Console applications can execute a handler on Windows shutdown, PSReadline actually needs a handler so history can be saved before the process is killed by Windows, see: https://github.com/lzybkr/PSReadLine/blob/master/PSReadLine/ReadLine.cs#L238 |
I'm closing this because I have no plans to add support to the ISE. There is significantly more effort being spent on PowerShell editor services which supports multiple editors, and I expect more editors to adopt the console like VSCode does. This isn't to say it will never happen, but unless someone else can pick up this work, it's not something I'll can find the time for. |
With
Import-Module PSReadLine
in my$profile
, opening a new tab in ISE doesn't seem to give a persistent bash history (which I understand is one of the benefits of psreadline)This looks like a known issue - https://github.com/lzybkr/PSReadLine#post-installation mentions checking for the host type to see if it's
ConsoleHost
- but it doesn't say why. Having history on tabbed powershell like ISE provides (without all the extra stuff in conemu) would be great.Get-InstalledModule
shows PSReadline 1.2. Other details below:Thanks for listening - I'm grateful for any help here!
The text was updated successfully, but these errors were encountered: