Description
I've been working hard over the last few weeks to bring a fully integrated PowerShell console to VS Code via the PowerShell extension. The work isn't finished yet but I wanted to share a preview release to get some initial feedback which will help guide the final steps to getting this released in 0.8.0 in late October.
The most interesting thing about this feature is that it uses the standard PowerShell console host to provide the interactive console experience. This is an improvement over what you get in the ISE because you're writing and testing your code in the standard PowerShell host rather than one developed specifically for the editor.
I've only tested this on Windows 10 with PowerShell v5 and v6 and on Windows 7 with PowerShell v3. Would certainly appreciate to hear whether it works on Windows 8 with PowerShell v4 as well (plus any other combination of Windows/PowerShell versions).
NOTE: This only works on Windows right now because I need to do some extra work to make the console launching operate correctly on OS X and Linux. I might send out an update of the preview within the next few days with full OS X and Linux support.
Disclaimer: USE AT YOUR OWN RISK
I have not followed the usual process of getting binaries signed for release because I just wanted to quickly get some feedback on this new feature without a full release process. As such, I am required to point out that downloading and using this preview is done at your own risk. Consult the project license for full legalese ;)
How to install and use it
- Install the latest Visual Studio Code Insiders release. This package does not work with the stable VS Code release (depends on APIs that haven't been released yet)
- Download this ZIP file and extract it into your
$HOME\.vscode-insiders\extensions
folder. - Load up a PowerShell project and open a
.ps1
or.psm1
file. The PowerShell console should open up shortly after and drop you directly into a PowerShell prompt.
Things to try
- Use the F8 hotkey to execute code from an editor tab like you would in the ISE. Does it do what you expect?
- Define a function in the console and then try to get IntelliSense for it in the editor
- Call
Get-Credential
or any other cmdlet that never worked right for you in VS Code. - Use the
psedit
command to open a file (same as in the ISE) - Try any of the
$psEditor
API methods from within the console - Change the
powershell.developer.powerShellExePath
setting to point to an installation of PowerShell Core on your Windows machine then restart VS Code. You should get the same console experience for both full PowerShell and the new open-source release of PowerShell. - Change the
powershell.useX86Host
setting to true if you want to try using the same experience with the 32-bit PowerShell console in a 64-bit Windows install. This also requires a restart of VS Code.
Things that don't work
- Probably a lot. I would not use this for real development yet, it's just a preview of what's coming next.
- PSReadline does not work. I need to work with @lzybkr to come up with a way to coordinate my usage of the runspace with PSReadline's. If you load the PSReadline module into your session, all language features will stop working.
- Script debugging mostly doesn't work. I need to do some hacking magic to make our existing debugging experience work with the console host's debugging implementation.
- Remote PowerShell sessions should work but IntelliSense and other language features will not be aware of the session. I'm planning to fix this before the official update.
Updates to the preview
As you report issues, I'll try to push out a few updates to the preview to resolve any major problems. I'll update this issue with the latest download links as we go.