-
Notifications
You must be signed in to change notification settings - Fork 510
Integrated Console Colors do not work on older Windows Versions without ANSI/VTY Support (2012R2 etc.) #3727
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
Comments
Thanks @mhdevop! Can you expand upon what you mean when you say Preview mostly works? Are you potentially changing your term env var set in your PowerShell profile? Have you experienced this issue in the PowerShell terminal in VSCode (not integrated console)? |
Also, do you experience this on OS's other than Windows Server 2012 R2? We can't seem to reproduce this. |
`PS C:\Users> $psversiontable Name Value PSVersion 7.2.1 PS C:\Users> code --version 1.63.2 ms-vscode.powershell@2021.12.0` I am seeing the same issue on Win10 but only when writing to a file. The issue seems to have started around the same time as mhdevop's post. For example, this line which writes to a txt file:
Outputs like this:
|
Hopefully these 2 videos answer both your questions (if I misunderstood do let me know). Basically the raw shell by itself works fine but in VScode it generates ANSI. When I switch to the "preview" version, it resolves the ANSI issue but as you can see, the terminal doesn't show the terminal sequence indicating the command finished running until you hit enter and neither does it "clear" correctly. I'm making no "manual" changes to my env var or other settings beyond switching the plugin from PROD > Preview: |
I can't "prove" it but I did see this issue semi-recently as well when looking in a log file I found a lot of ANSI characters. Can't remember where it was though or what generated it. If it helps here's what I'm running:
|
Ok, I think that what's happening is that the PowerShell Preview extension has no support for console colors yet, as we haven't yet implemented that part of the host. So no ANSI escape codes (which represent the colors) are being emitted by the Preview. We're tracking that issue here: PowerShell/PowerShellEditorServices#1607 |
Just FYI - I was able to exactly reproduce this issue on a different 2012 R2 server (updated VScode, updated PowerShell plugin, and same version of PowerShell 7). I have asked that the server do an in-place upgrade to OS 2019 which I suspect will resolve the issue but I'll find out in the coming days/weeks. I have an existing 2019 server that works perfectly fine with this setup, just that pesky 2012R2 has issues. I'll update this issue once I know more unless you all want me to try something in between then. |
That's specifically for the non-preview extension right? |
Correct. Every single issue down to the letter is the exact same. |
Ok, well the "stable" extension is just old code that will be updated with the "preview" extension soon enough. There's no need to keep testing it, it's the preview extension where bug fixes can be made. |
Understood. Look forward to the new 'preview' in this issue correcting both issues demonstrated in the 2 above screenshots then (like someone mentioned here likely due to handling colors): 1) showing the terminal start at the end of running a command 2) clearing the screen after the command I'll let the experts get on with it then and let me know if I can provide anything else to help. |
There's a good chunk of terminal improvements to be made. The underlying way we used PSReadLine changed drastically (for the better!) but it's left us with quite a bit to reimplement. |
FYI - I just had my 2012R2 to 2019 and the "non-preview" works fine now with colors as an added bonus. Preview still has the bug shown above where the command doesn't show the terminal character once it's done running so you're not sure if it ever finished until you hit enter. |
Awesome, sounds like it's just lack of ANSI color support in 2012R2. Newer versions of Windows with newer versions of PowerShell have much better support for it. Since the preview doesn't leave buggy unreadable output, but will eventually support The terminal character issue actually appears to me to be the same bug as #3685 where the prompt isn't being rendered in the correct spot (that is, it should render after the output, but instead is rendering after its last location). The effect of this is that it doesn't look like it renders at all until you start typing letters which overwrite the output (or in your case, press enter and have the new prompt line render over the top of your output). |
I would like to +1 this. This happens for me as well. Even for simple commands like
I would, however, like to add that using PowerShell Core from the VSCode Terminal doesn't reproduce the issue. Same for Edit: I tried to disable "PowerShell" and installed "PowerShell Preview" and it works. However, I do not have that issue where existing buffer doesn't clear after using |
I'll let you folks decide if this is "resolved" or not now that I have a workaround (an entire OS upgrade). I mean the issue does exist, it has been replicated on 2012R2, so it is an issue but I'm sure it's lower priority compared to other bugs. |
@mhdevop seeing as 2012R2 is EOL in a year and a half, I doubt a lot of engineering effort is going to go into this honestly, unless someone wants to attempt a PR, which we will facilitate. I am going to rename the issue to be 2012 specific and flag it as "up for grabs" |
@mhdevop Can you test the latest preview? We redirected the host's |
Yes! The preview did fix it. |
Yay!!! |
All thanks to @SeeminglyScience. |
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes. |
hi, all hope you are all fine, i have same issue in win 2012 r2 with colors, i saw the solution but i have no idea how to fix or implement it, any guide or help will be much appreciate it. thanks |
Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead. |
@ocarela Can you provide a screenshot? As noted from the bot, a new issue would be helpful if you can reproduce! |
Prerequisites
Summary
VScode with this extension have worked great for roughly a year but at some point I'm not sure of, a weird issue started happening on my dev server (Windows Server 2012 R2). ANSI characters started showing up in the integrated console.
Expected:
Actual:
Things I've already tried:
Google of course
Un/Re install VScode
Upgraded PWSH
Tested the command directly in the native pwsh shell and works perfectly (seems to suggest something within the VScode integrated console)
PowerShell Version
The text was updated successfully, but these errors were encountered: