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

Format Document command corrupts text strings in Powershell documents #2870

Closed
u2ill opened this issue Aug 6, 2020 · 4 comments
Closed

Format Document command corrupts text strings in Powershell documents #2870

u2ill opened this issue Aug 6, 2020 · 4 comments
Labels
Resolution-Inactive Will close automatically.

Comments

@u2ill
Copy link

u2ill commented Aug 6, 2020

Issue Type: Bug

Take the following 3 lines of orignal Powershell code:

Write-Output "`n`rTurning $State the $scope environment..."
$i=1+2|ft
Write-Output "`n`rCopied tags from RDS instance '$($vars.rdsInstanceIdentifier)' to RDS snapshot '$($vars.DBSnapshotIdentifier)'"

When performing a "Format Document" command on this code in a Powershell file, VS Code changes the code to the following:

Write-Output "`n`rTurning $State $scope environment..."
$i = 1 + 2 | Format-Table
Write-Output "`n`rCopied tags from RDS instance '$($vars.rdsInstanceIdentifier)$($vars.DBSnapshotIdentifier)'"

Line 2 is the only correctly formatted line - spaces are added and the alias is expanded.
But line 1 and 3 have their data corrupted!
Line 1 - the word 'the' between the $state and $scope variables has been removed.
Line 3 - the 3 words 'to RDS snapshot' between the two variables on the line have been removed.

There seems to be a problem when formatting data embedded in text quotes. I ran the same 3 lines through the PSScriptAnalyzer that is included in VS Code, and the output is as expected. Something in VS Code (not PSScriptAnalyzer) is corrupting data when formatting Powershell documents.

Extension version: 2020.6.0
VS Code version: Code 1.47.3 (91899dcef7b8110878ea59626991a18c8a6a1b3e, 2020-07-23T13:12:49.994Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.89GB (3.94GB free)
Process Argv
Screen Reader no
VM 0%
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 6, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Aug 6, 2020

Please share any logs you have to help us understand what's happening here

@SydneyhSmith SydneyhSmith removed the Needs: Triage Maintainer attention needed! label Aug 6, 2020
@DarkMorford
Copy link

This seems to have been fixed in PowerShell/PSScriptAnalyzer/pull/1498, included in PSScriptAnalyzer 1.19.1. Is there a way to update the VS Code extension's copy of that module until a new release comes out?

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

Yes. You can do:

Install-Module PSScriptAnalyzer

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Aug 13, 2020
@ghost
Copy link

ghost commented Aug 28, 2020

This issue is being closed as inactive, if this issue is still occurring it will be re-opened

@ghost ghost added the Resolution-Inactive Will close automatically. label Aug 28, 2020
@ghost ghost closed this as completed Aug 28, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Inactive Will close automatically.
Projects
None yet
Development

No branches or pull requests

5 participants