-
Notifications
You must be signed in to change notification settings - Fork 501
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
Feedback needed: Try out a preview of integrated console support! #311
Comments
Couple things I have noticed. |
Hmmm, weird. I'm surprised the that the ZIP file would have caused a problem. Do you have the error handy? If not that's OK. Not sure why the tab completion would be messed up there, got a screenshot of that? Thanks for the help! |
The ZIP file wouldn't cause an issue - Windows saw this as a remote file and then when you extract, all the extracted files will be remote as well. You just have to unblock the ZIP before you extract. |
|
@daviwil could you do a powershell-preview or similar extension and put it in the marketplace? |
I'm interested to see if this fixes run selection for me. It was broken with current console. @Tyriar was hoping this integration will get that working. It currently doesn't treat code blocks as a whole, but instead each line individually. |
@gerane Yeah, I've considered that recently, might try it at some point. @mattmcnabb Thanks for the notes! And thanks for reminding me about profile, I forgot to mention that this should be loading the Microsoft.VSCode_profile.ps1 instead of the standard ConsoleHost profile. If people end up disliking that behavior I'm happy to change it. Ctrl+C definitely works for me if I'm running a script and want to cancel its execution. Does it work for you in that case? If not then it may be an issue I need to investigate. |
@mattmcnabb ctrl+c has been broken in the integrated terminal for a while. If you highlight text it will copy, but if you highlight text or use ctrl+c in the prompt portion it throws an error. Do you can't break out of running code. It's one of my biggest gripes. |
@daviwil do you think your integration fixed the ctrl+c to break or did they just recently fix this in there insiders maybe? |
@gerane Might have been fixed this week at some point in Insiders, I hadn't tried it before that. Has been working well for me! |
@daviwil I'll try it in the morning. There was an update towards the end of the day that I didn't install. |
@daviwil I realty do think out would be beneficial to have a preview or beta flag for extensions though. I wonder if this has ever been considered. |
Not sure, I was looking for an issue about that on the VS Code repo but didn't see one. I'll file one tomorrow |
You can add "preview" text as in https://marketplace.visualstudio.com/items?itemName=Tyriar.terminal-tabs by adding |
@Tyriar And I think I know an extension I'll be trying out in the morning. I left a comment on that issue. |
@Jaykul reports that text seems to get sent to the terminal in reverse line order (using F8) after he loads his Profile module. Need to investigate why that's happening. |
Only after profile? Do you think commands that alter your prompt are impacting it? |
@Jaykul is heavy into developing his PowerLine prompt module. :-) |
wow dude, this is absolutely stunning, love my vscode even more now! |
Installed and loaded without issue. I did need to unblock the zip file, as described above. |
So, my profile.ps1 has LF endings (not CRLF). I modified the Even then, hitting F8 in my profile script results in the selected lines being put into the console in reverse order. I know that's not a very narrowed-down repro (that module depends on other modules, and together they import a lot of code) but it'll take some time to figure out why that's happening. |
@mgreenegit glad to hear it worked after unblocking the files! @Jaykul I'll give that a shot when I get into the office and see if I can figure out what the deal is |
My .zip was not blocked. Had to unblock the start-editorsevice.ps1 though |
I didn't get to test it today. Had some other things take priority. I did test ctrl+c default behavior @daviwil . If I have the cursor active in the prompt I get an error saying the terminal isn't the active window, but if I click above the prompt it will properly accept ctrl+c. @Jaykul what behavior do you get in the terminal prior? I ask because I have broken behavior with the run selection key binding, and I've wondered if it could be caused by my custom prompt, or if it's broken across the board. |
@Jaykul was also wondering if it could be a line ending issues too. |
@daviwil just installed it, noticed a few things right off.
This was what I first saw, I will see what else I can find. If you want to talk in more detail or see more let me know @daviwil |
Also, @Tyriar some of the weird run as selection issues we were discussing, they are being caused by the built in module PSReadline. Maybe we can look a bit more into this and see if we can figure out the cause. |
@daviwil actually, odd, it doesn't look like it loaded my VSCode profile either. All of my editor commands weren't loaded. |
@daviwil it doesn't appear to be loading a profile for all for me. |
Yeah, Doug submitted a pull request for the Show*Message APIs, I'm going to merge it in for 0.8. Basic Editor Commands are working for me, maybe yours aren't working because they depend on the prompt stuff? I'll get PSReadline working in 0.9 hopefully, I'll need to enable a hook in PSReadline so that it will give me access to the runspace when I need to run a command. |
@daviwil yeah, I only tested ones with prompt
|
@daviwil @gerane yes! It appears my paste problem is resolved by (re)unloading PSReadLine after importing that Module profile: it sets a bunch of PSReadLine preferences |
😃 |
It will make me sad, but now that I've got PS5 everywhere (where PowerShell itself pre-loads the module), maybe I should stop testing to see which host I'm in before using PSReadline, and instead, just test whether it's currently loaded -- if someone has unloaded it for some reason, obviously I don't want to interfere with their devious machinations 😈 |
I'm not sure if you care to provide this level/depth of backward compatibility, but because I recently got my hands on a rebuilt Win7 with PS v2, I thought I'd give this a go, before upgrading to more current WMF. I saw the earlier comments about unblocking the zip, and so Unblocked before extracting, and haven't found any extracted files with blocking/blocked issues. I set my ExecutionPolicy to RemoteSigned in the main consolehost, but checked in the extension instance, and noticed it was already at Unrestricted, so I don't think that's inhibiting functionality. Neither F8 hotkey nor Here are the error message that appeared on first launch:
I tried I also tried
On a positive note: get-credential worked fine for me, |
@Jaykul I'm going to provide another way to find out if the console host is being used in an editor, Ultimately I want to get PSReadline working with PSES so hopefully this won't be an issue in the future. However, that will bring us back to the terminal pasting issues... We'll have to see why things don't work so cleanly in the VS Code integrated terminal UI. |
@bcdady Hey Bryan, thanks for giving this a shot! The PowerShell extension unfortunately doesn't support PSv2, only PSv3 and above. A lot of the errors you're seeing are due to me using things that are not available in PSv2. Was worth a shot though! |
Ooo, sadly I missed this so I couldn't help in testing. Is it due a release soon? |
@GHRoss right now I'm shooting for end of October or early November. Still got a lot of work to finish to make it work well. |
Thanks @daviwil - I've updated now to v3, and the earlier reported errors are gone. |
Is there a shortcut-key, or a way to map keystrokes to jump focus/cursor from editor to console? |
Regarding the hotkeys, not yet, but I just filed issue #318 to track that. Also, profiles aren't being loaded in this preview release of the integrated console, I'm adding that back now and might send out an update to the preview in a few days. |
While testing with PowerShell v3, I've encountered some code snippets that hang the integrated terminal/console to the point that ctrl+c doesn't recover control. In this case, I resort to clicking the Trash can icon to 'Kill Terminal'. But then I can't find a way to re-start a PowerShell Terminal/console. Clicking the + will add another cmd.exe Terminal/console instance, but the only way (so far) to recover from the hung PowerShell instance is to restart the VS Code - Insider application. Let me know if you need any further detail, or would prefer I log this as it's own 'Issue'. |
Hmmm, weird, snippets are hanging the console? That's strange, is there a specific one I can try that would reproduce the behavior? Since releasing this preview I've implemented a "Restart Interactive Console" command which will make it much easier to restart the session without reloading VS Code. I'm planning to post a new preview ZIP tomorrow with some nice improvements, I'll let you know when that's out. |
OK folks, I need your feedback on a dilemma I'm facing with the integrated console work. I'm becoming increasingly concerned that leveraging the standard "ConsoleHost" is going to be harder to get right than I thought. I'm not certain that it's a bust yet but I don't want to sink any more time into it if it isn't truly valuable. What if PSES had it's own console-based host implementation which borrowed as much of the standard ConsoleHost code as possible while having it's own implementation where it mattered? I don't know for sure yet how much this would cause PSES' host to deviate from the ConsoleHost's behavior, but since this will be written and used as a console application we should be able to reach close compatibility. The main benefit is that we'd have more control over the hosting environment to provide a more reliable host across the various PowerShell versions we support. My main concern with continuing the work to hijack the ConsoleHost is that building our editing experience around reflection-based hacks will be more buggy and error prone in the long term. What do you think? Is using the standard ConsoleHost valuable enough to continue down that path even if it means the editing/debugging experience might not be as smooth? |
Is the ConsoleHost really that valuable at all? I've often thought of it as a limitation and a roadblock to PowerShell adoption. Just look at the number of folks out there on social media that complain about PowerShell, only when questioned their gripes are actually about the ConsoleHost and it's lack of features (improving a lot, I know). This is what drives many to suggest using the ISE while learning PowerShell to take advantage of copy-paste, highlighting, etc. To balance your question I would say - "What might we lose by dropping the ConsoleHost?" I don't think anyone would fight you on this if the experience will be better/less buggy. However, if there is a significant loss of functionality then that might be a problem. From my limited knowledge, I don't believe there will be any real loss, though. |
I don't have enough insight on the custom host v. ConsoleHost. What I know of your ConsoleHost host approach sounded really cool and ambitious. Reflection-based hacks, always come back to bite. The notion of having PSReadline and more in the vs code console is good. Having a consistent console across the boards is optimal. I don't know if that's doable given the legacy issues. Don't know it it's time to break from the that and a better path can be blazed. |
I don't mind if VSCode-powershell has its own host for debugging and editing REPL work. If that host has enough implemented to be my primary VSCode integrated terminal even better. But that means it must handle PSReadLine and posh-git correctly. :-) But if it can't that's OK too as long as I can still bring up PowerShell in the default VSCode terminal window. Which I currently can with the VSCode 1.7/VSC-PS 0.7.9. I think the only issue then would be a bit of education that "hey, the PS Interactive Console" is a REPL for editing and debugging. For your daily driver for say Git, gcc, etc use the BTW I do want an easy way to ensure I've got a fresh PSIC when starting a debug session. I think I can do that by closing the current PSIC and a new one will be started, right? |
Thanks for the feedback guys! One thing I probably didn't clarify well enough: this will still be a terminal-based app and the REPL experience you get will be very similar to what you see in the current preview. Also, PSReadLine would play a big role because I'll modify it slightly to drive the console experience. It basically reimplements the ConsoleHost's input loop so I should be able to take it with some minor modifications and use it to drive my own input loop. The end goal would be a terminal experience that feels enough like the ConsoleHost + PSReadLine where most users wouldn't be able to tell the difference. I think I'll do a quick investigation today to see whether it'll be less work to try out this idea than to continue on with the ConsoleHost hacks. |
Do you have the same issues with latest Windows 10 Insider builds? Is it improved? It would be better for Windows 10 long-term if the issues get resolved in the standard ConsoleHost. That doesn't help with legacy, so you may still have to do a custom ConsoleHost for Windows 7-8 based systems. For example, Windows 10 gaining 24-bit color support. Are we saying that work will not apply now in PSES unless you add that to the custom host? |
@dragonwolf83 the "console host" I'm referring to is However, the 24-bit color support of the PowerShell console running in VS Code will definitely be limited by VS Code's terminal implementation. I'm not sure if 24-bit color is supported right now but my guess is that it's not. |
A slightly modified Note that "better" integration of PSReadline in the console host is problematic. I went with that approach in some early internal builds of V5, it caused problems that weren't easily solved. I'd have to dig some in the SD history to recall what those issues where, but I recall being unhappy removing the tighter integration with PSReadline. |
@lzybkr I need to find a solution that will work with PSv3 and up. Improving the PSv6 ConsoleHost doesn't help there unless we can find a way to make it work across my supported range of PowerShell versions. Let's discuss it next week sometime when you're back, would certainly appreciate your help to determine the best course of action! |
As a followup to the Win7 PSv2 issue bcdady brought up, is there an option to disable the integrated console? Sadly, upgrading to a newer WMF will not be an option and basically here for syntax highlighting. |
VS Code has PowerShell syntax highlighting built in so the only real value you get on PSv2 is the snippets this extension provides. If you install the current release of the PS extension (0.8.0) then it should give you a warning about using an unsupported PowerShell version. If it doesn't then I'll need to fix that. |
Thanks! I forgot about the snippets as well. It does throw the Remove-Module error listed above, not a version warning. |
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
$HOME\.vscode-insiders\extensions
folder..ps1
or.psm1
file. The PowerShell console should open up shortly after and drop you directly into a PowerShell prompt.Things to try
Get-Credential
or any other cmdlet that never worked right for you in VS Code.psedit
command to open a file (same as in the ISE)$psEditor
API methods from within the consolepowershell.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.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
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.
The text was updated successfully, but these errors were encountered: