Skip to content
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

Unexpected characters in VSCode PS Integrated shell commands #2637

Closed
ZZStoner opened this issue Apr 16, 2020 · 12 comments · Fixed by PowerShell/PowerShellEditorServices#1263 or PowerShell/PowerShellEditorServices#1264

Comments

@ZZStoner
Copy link

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
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 16, 2020
@TylerLeonhardt
Copy link
Member

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

image

@TylerLeonhardt TylerLeonhardt added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Apr 16, 2020
@ZZStoner
Copy link
Author

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.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 17, 2020
@TylerLeonhardt
Copy link
Member

Ah this is the new prediction feature in PSReadLine.

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

@daxian-dbw
Copy link
Member

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?

@TylerLeonhardt
Copy link
Member

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

@ZZStoner what version of Windows are you on?

@dnelson6
Copy link

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 

@Tyriar
Copy link
Contributor

Tyriar commented Apr 17, 2020

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

@ZZStoner
Copy link
Author

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

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Apr 17, 2020

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

@ZZStoner
Copy link
Author

Thanks. The workaround unblocked me.

@Schwanowski
Copy link

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

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 27, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 27, 2020
@merlinfrombelgium
Copy link

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

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

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jul 8, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants