Closed daviwil closed 5 years ago
i was going to request this yesterday but i got distracted.
Thank you!
Hopefully this will include PSReadline's Vi EditMode and ViModeIndicator. I found this issue while searching for a way to get vi mode working.
Um, @daviwil, when did PSReadline start working in the VSCode PowerShell terminal window? I just opened the terminal and noticed my PSReadline history was available. A quick Set-PSReadlineOption -EditMode Vi
and I'm in hog heaven!
Is there something I should be watching for? I guess I should mention: Windows 10 Anniversary Update, PowerShell 5.1, VSCode 1.13.1, PowerShell addin 1.4.1...
PSReadline support in the PowerShell terminal
is a VSCode feature. What isn't implemented yet is PSReadline support in the PowerShell Integrated Console
.
Hey Greg, unfortunately you're just seeing PSReadLine work inside of plain powershell.exe in the integrated terminal. As Keith mentions, it doesn't currently work in the PowerShell Integrated Console yet. I've started working on that last week though so I expect to have some progress soon!
Thanks @daviwil and @rkeithhill! I guess I need to start playing with the Integrated Console because I'm sure I knew it was there. It will be great to have PSReadline support because that one particular feature is why I abandoned the ISE a long time ago. I'm such a lousy typist I need all the help I can get. ;-)
@daviwil any update on this killer feature? ;)
Will this also make it so Clear-Host actually clears the terminal window and doesn't just move the input line to the top of the screen?
Hi!! @daviwil,
Any update on this enhancement ? It sure is one of the few things that keeps me going back to ISE or the powershell console from time to time.
On a sidenote... I really hope this great project is not put on hold.. cause it seems that there's less and less activity in the repo.
Thanks for all the work!
Just adding a 'me too'.
As far as I can tell, this is the feature needed to allow for shelving of ISE for VScode. I love the GIT integration in VScode, but the crippled debug is a show stopper.
I'm guessing that the PSReadLine support may fix the $host.PrivateData issue also? (it contains terminal color values, just not in the integrated console)
It's coming. Still some kinks left, but it's coming.
I'm guessing that the PSReadLine support may fix the $host.PrivateData issue also? (it contains terminal color values, just not in the integrated console)
Definitely not related. I didn't get a chance to look at it this weekend but we'll get it fixed for sure :)
omg that looks awesome @SeeminglyScience, I'm so pumped 🎉
Looks great @SeeminglyScience! I'm ready to ditch ISE :)
Found this while trying to get syntax highlighting working in the integrated console. I look forward to this being available! Great work!
@SeeminglyScience Any ETA for seeing this in Insiders? This is the final piece to having a comfortable single pane workflow and not need to set up a side-by-side ConEmu instance.
Thanks for the work!
@Liquidmantis I'm thinking I can get a solid build of it behind a feature flag not next release but the one after. No promises as I'm a little short on free time atm, but that's the goal :)
@SeeminglyScience that's great to hear! can't wait to finally have PSReadline support, thanks
I got it working, all you do is import the module ;) Read the install instructions for PowerShellGallery, it's fairly straightforward.
@darkquake93 if you just import the standard PSReadline module into the PS extension's Integrated Console, it will break all language and debugging functionality. @SeeminglyScience's work is to enable PSReadline to coexist with the PowerShell extension's language capabilities.
Oh I didn't realise. I only use Powershell for minimal use on my home Windows 7 machine, and all seems good for the time being with syntax highlighting and ctrl+delete etc working. I'll keep that in mind though, but my computer at work is already on Windows 10 so that's probably where I'll do debugging in the future, I just like to run simple scripts at home :)
When o When will this be there?
You're welcome to try installing the module anyway like I did, I found it was good enough.
@darkquake93 It sounds like you are talking about getting PSReadLine to work in Windows 7, this discussion is for getting PSReadLine to work within the console created by this extension in VSCode. We explicitly remove the module at start up because it breaks all editor features, just installing the module wouldn't make a difference in this case.
Oh sorry, you're right. Thanks for the explanation anyway.
Any update on when this will be available?
Any news about this feature?
@SeeminglyScience is working really hard on this. We had a demo at the MVP Summit in March but it still has a few bugs he is figuring out. It's a substantial change to PowerShell Editor Services.
:shipit:
Not sure if it's the same core problem, but when hitting F8 on a line of code, focus changes to the integrated console instead of the code, which is different from powershell_ise behavior. I prefer the powershell_ise behavior, not sure how many others do. (Answered below by tylerl0706 - thx)
@uttampcu you're going to want to set the powershell.integratedConsole.focusConsoleOnExecute
setting. That will do what you want. It behaves the way it does in order to be accessible.
Any workarounds available for Issue #535 while we wait? Can we get @SeeminglyScience 's pre-release code to reduce the pain?
Is inability to press arrow up/down to go previous/last command issued during debugging is part of this issue?
@artisticcheese that will also be fixed with PSReadLine
Looking forward to this update also!
I believe our integration with PSReadLine depends on a PSReadLine 2 API, which is incompatible with PowerShell versions below v5. So before we can bring PSReadLine in, we will need to resolve our support story for PowerShell v4 and below.
Please see here: https://github.com/PowerShell/vscode-powershell/issues/1310
To me, this sounds like this will last a long time before we get this available. I opened an issue back in August 2017 (https://github.com/PowerShell/vscode-powershell/issues/975 ) mentionning the fact that history and up and down arrow keys don't work. I got told it would be fixed with the introduction of PSreadLine.
As matter a fact, according to https://github.com/PowerShell/vscode-powershell/issues/1310 mentionned above, you want to drop the support for powershell v3, v4. Which means that the original issue (that a lot of people seem to be asking for) won't be fixed when working on scripts on older versions of powershell.
To me, this is a crucial functionality for any IDE, which really enhance the user experience. I think everybody has waited pretty long for this fix. This drives me nuts sometimes, and I was actually really looking forward to it.
@Stephanevg I understand your frustration but that issue in particular is more complicated than it probably appears. I looked into this awhile ago and the fix is actually pretty easy, but it's currently hiding a bigger issue.
Right now when you run a command through the debugger there is no way to suppress it from history. This includes all of the commands we run in the background to get variables, the call stack, intellisense, everything. A lot of those commands get invoked every single time a command is ran from the prompt and/or every time the debugger steps. So currently, if you could navigate history, you'd be looking at mostly the background commands.
Keep in mind this is a PowerShell API, so the older versions are pretty much set in stone. Usually we can find some sort of workaround to kind of fake the same functionality, but this one is pretty solidly hard coded in.
PSReadLine solves this in a way because it has it's own history management system. But getting that working with the other editor features requires changes to PSReadLine. Older versions of PSReadLine support PSv3/4 but the newest one (the one we have to add these changes to) does not.
All that said remember you can still write scripts targeting v3/4, you only need PSv5.1 installed on your dev machine. For example, if you are currently writing scripts that target PSv2 then nothing will change because we already don't support that version.
Getting closer! https://github.com/PowerShell/PowerShellEditorServices/pull/672
It looks like that PR has been merged into 2.0.0 - What is left to get it working with this extension in insiders? Is there anything that could use love to get this closer to reality?
@BatmanAMA @rjmholt is working on migrating PowerShell Editor Services to .NET Standard 2.0 and PowerShell Standard.
https://github.com/PowerShell/PowerShellEditorServices/pull/741
Here's a build from that latest PR (which is pretty much complete) with the PSReadLine features enabled: psvsix.zip
(GitHub won't let me upload a VSIX directly, but just expand the zip and it will be in there)
To install:
code --install-extension ./PowerShell-v2-insiders.vsix
Or if you use VSCode Insiders:
code-insiders --install-extension ./PowerShell-v2-insiders.vsix
Then you will need to enable the feature in your VSCode user settings by adding to the feature flags:
{
"powershell.developer.featureFlags": [
"PSReadLine"
]
}
There are still come trickier bugs, mainly on *nix.
If you're interested in the source, the backend can be built from this branch (I made a new one where the PSRL import is hardcoded, since the newest PowerShell Core overrides our PSRL with one that has the same version but is older -- we're waiting on the next PSRL release to fix that). The frontend is based on this branch (which is just the normal frontend with the versions changed to make installation nicer), but needs these lines removed.
Anyway, give it a try and let us know how it goes.
Right after having the new version installed, debugging was no longer possible:
Cannot debug or run a PowerShell script until the PowerShell session has started. Wait for the PowerShell session to finish starting and try again.
After some time, I get this error:
The language service could not be started:
The log shows:
9/6/2018 1:29:01 PM [NORMAL] - Visual Studio Code v1.26.1 64-bit
9/6/2018 1:29:01 PM [NORMAL] - PowerShell Extension v2.0.0
9/6/2018 1:29:01 PM [NORMAL] - Operating System: Windows 64-bit
9/6/2018 1:29:01 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
9/6/2018 1:29:01 PM [NORMAL] - Language server starting --
9/6/2018 1:29:01 PM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
9/6/2018 1:29:01 PM [NORMAL] - args: C:\Users\randr\.vscode\extensions\ms-vscode.powershell-2.0.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2.0.0'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\randr\.vscode\extensions\ms-vscode.powershell-2.0.0\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\randr\.vscode\extensions\ms-vscode.powershell-2.0.0\logs\1536233341-15e829a8-2222-4bfd-8dd7-003ff46574671536233335047\EditorServices.log' -SessionDetailsPath 'C:\Users\randr\.vscode\extensions\ms-vscode.powershell-2.0.0\sessions\PSES-VSCode-19296-915042' -FeatureFlags @('PSReadLine')
9/6/2018 1:29:01 PM [NORMAL] - Syntax Folding Provider registered
9/6/2018 1:29:02 PM [NORMAL] - powershell.exe started, pid: 5920
9/6/2018 1:31:01 PM [NORMAL] - Language server startup failed.
9/6/2018 1:31:01 PM [ERROR] - The language service could not be started:
9/6/2018 1:31:01 PM [ERROR] - Timed out waiting for session file to appear.
@raandree This is a shot in the dark, but what's the highest .NET Framework version you have installed? If it's under 4.7.1, try installing that.
@raandree I have the same issue and I have found that the Microsoft.PowerShell.EditorServices.dll library is not in the expected path when the 'Start-EditorServices.ps1' script runs.
from the PowerShellEditorServices.psm1 ::
if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") { Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.dll" Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll" } else { Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.dll" Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Protocol.dll" Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Host.dll" }
On my system, I don't have Powershell 6 installed, only the Desktop version (5.1) and in the .\ms-vscode.powershell-2.0.0\modules\PowerShellEditorServices\bin folder, there is only a 'Core' folder, no 'Desktop' folder.
It seems to me that this would only work with Powershell Core installed.
@rjmholt has been working on porting all of PowerShell Editor Services to .NET Standard and this seems to be a place he missed.
Windows PowerShell 5.1 will be supported.
@SeeminglyScience, thanks for the hint, but .net 4.7.2 is installed.
PS C:\> Get-DotNetFrameworkVersion
ComputerName Build Version Comment
------------ ----- ------- -------
RAANDREE1 50727 2.0.50727.4927
RAANDREE1 30729 3.0.30729.4926
RAANDREE1 30729 3.5.30729.4926
RAANDREE1 461808 4.7.2 (Windows 10 1803)
@djobin, this is it. Missing the Desktop folder as well.
When do we get a new build to play with?
@raandree Just finishing one up now (sorry, currently in an Australian timezone, so a bit out of kilter with US business hours)
PSReadline is not supported in the integrated console at this time. A non-trivial amount of work is needed to make PowerShell Editor Services and PSReadline play nicely together so this could take some time.
Features this will enable: