Vscode-powershell: Unexpected characters in VSCode PS Integrated shell commands

Created on 17 Apr 2020  路  12Comments  路  Source: PowerShell/vscode-powershell

Issue Description

After upgrading the PS Extension in VS Code to 2020.4.0, I noticed the PS Integrated Shell showing garbage characters when trying to type any commands.

Example showing strange extra characters after only typing dir:
VSCode.PS.CmdLineMess.jpg

Attached Logs

_Note to Team: The README link to the Reporting Problems below returns a 404 Not Found._

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

| Name | Version |
| --- | --- |
| Operating System | Windows_NT x64 6.3.9600 |
| VSCode | 1.44.1|
| PowerShell Extension Version | 2020.4.0 |

PowerShell Information

|Name|Value|
|---|---|
|PSVersion|5.1.14409.1018|
|PSEdition|Desktop|
|PSCompatibleVersions|1.0 2.0 3.0 4.0 5.0 5.1.14409.1018|
|BuildVersion|10.0.14409.1018|
|CLRVersion|4.0.30319.42000|
|WSManStackVersion|3.0|
|PSRemotingProtocolVersion|2.3|
|SerializationVersion|1.1.0.1|

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)

|Extension|Author|Version|
|---|---|---|
|csharp|ms-dotnettools|1.21.17|
|gc-excelviewer|GrapeCity|2.1.34|
|kuskus-extensions-pack|rosshamish|1.0.1|
|kuskus-kusto-color-themes|rosshamish|0.1.0|
|kuskus-kusto-language-server|rosshamish|1.0.1|
|kuskus-kusto-syntax-highlighting|rosshamish|1.1.8|
|material-icon-theme|PKief|4.0.1|
|mssql|ms-mssql|1.9.0|
|powershell|ms-vscode|2020.4.0|
|rainbow-csv|mechatroner|1.6.0|
|team|ms-vsts|1.161.0|

Area-Integrated Console Issue-Bug

All 12 comments

Hi @ZZStoner I'm having trouble repro'ing this. Can you comment out everything in your $PROFILE and see if this still repros?

image

Currently with v2020.4.0:

I cleared out my Microsoft.VSCode_profile.ps1 (well, it only has a single line which is a comment)
Then reloaded VS Code. It still reproed.
I then chose to downgrade to v2020.3.0

Downgraded to v2020.3.0:

The PS Profile is empty.
Typing the first command worked as expected with no artifacts...
VSCode PS 2020 3 0 OK
I closed and reopened VS Code to make sure things worked consistently.
I then chose to upgrade back to v2020.4.0

Upgraded back to v2020.4.0 again:

The PS Profile is empty.
Still have crazy artifacts while typing.
VSCode PS 2020 4 0 Back

Potentially related:

I noticed the garbage text seems to have the same format as the properties from Get-PSReadLineOption.

Sample from Get-PSReadLineOption:

ParameterColor                         : [90m"$([char]0x1b)[90m"[0m
PredictionColor                        : [38;5;238m"$([char]0x1b)[38;5;238m"[0m
SelectionColor                         : [30;47m"$([char]0x1b)[30;47m"[0m

The value of PredictionColor is interesting because the "238m" is also seen in my snips.

Ah this is the new prediction feature in PSReadLine.

@daxian-dbw can you take a look at this?

Sample from Get-PSReadLineOption:

ParameterColor                         : [90m"$([char]0x1b)[90m"[0m
PredictionColor                        : [38;5;238m"$([char]0x1b)[38;5;238m"[0m
SelectionColor                         : [30;47m"$([char]0x1b)[30;47m"[0m

This indicates that the VT100 escape sequences are not correctly handled by the VS Code terminal.
@TylerLeonhardt are you aware of any issues of the VS Code terminal related to VT100 support?

Hmm they should be handled correctly... @Tyriar do you have any thoughts?

@ZZStoner what version of Windows are you on?

I am also experiencing this same garbage text. Downgraded to v2020.3.0 and all is well.

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | select EditionID, ProductName, CurrentBuildNumber

EditionID      ProductName                     CurrentBuildNumber
---------      -----------                     ------------------
ServerStandard Windows Server 2012 R2 Standard 9600 

If the terminal is printing then the terminal is likely not getting the escape character. You can check exactly when the terminal gets by following this https://github.com/microsoft/vscode/wiki/Terminal-Issues#enabling-escape-sequence-logging

To follow up, I am also using Windows 2012 R2.

Just to get you unblocked... you can remove this folder:

C:\Users\[YOUR USER]\.vscode\extensions\ms-vscode.powershell-2020.4.0\modules\PSReadLine\

NOTE: If you're on insiders it's \.vscode-insiders\

If your console doesn't give you syntax highlighting, simply reinstall PSReadLine the normal way:

Install-Module PSReadLine -Force -AllowClobber

Thanks. The workaround unblocked me.

I have had the same issue and the workaround worked for me too.

Install-Module PSReadLine -Force -AllowClober

powershell Install-Module : A parameter cannot be found that matches parameter name 'AllowClober'.

Serves me right for copy-pasting code from a forum thread 馃ぃ

Was this page helpful?
0 / 5 - 0 ratings