Vscode-powershell: Format-Table output breaks with VT100/ANSI escape sequences

Created on 10 Jun 2020  路  4Comments  路  Source: PowerShell/vscode-powershell

System Details Output

### VSCode version: 1.46.0-insider 9f89da69154ac6c99dfa7c82986e2df95b7bbe0b x64

### VSCode extensions:
[email protected]

### PSES version: 2.2.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Output from Format-Table breaks inside the integrated console when you add vt100 sequences to change the colors. This works fine in every other terminal I've tried that supports this feature.
You can try this out with the following code:

$TableOutput=Get-NetIPAddress -AddressFamily IPv4 | Format-Table
$i=0
foreach ($Line in $TableOutput)
 {
     $FieldList=$Line.formatEntryInfo.formatPropertyFieldList

     if ($FieldList)
     {
        $i++
         if ($i%2 -eq 0)
         {
             foreach ($Property in $FieldList)
             {
                 $Property.propertyValue="$([char]27)[92m$($Property.propertyValue)$([char]27)[0m"
             }
         }
     }
 }
$TableOutput

Expected Behaviour

Expected

Actual Behaviour

Actual

Area-Integrated Console Issue-Bug Resolution-Duplicate

Most helpful comment

It look like this is related to the PSES issue: https://github.com/PowerShell/PowerShellEditorServices/issues/840

All 4 comments

@MartinGC94 thanks for opening this, we are able to repro this

It look like this is related to the PSES issue: https://github.com/PowerShell/PowerShellEditorServices/issues/840

I'll mark this as a duplicate to the PSES issue since that has some more information on how we could fix this.

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Was this page helpful?
0 / 5 - 0 ratings