PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.86k stars 378 forks source link

Code Format command in vscode is removing syntax from the script. #1622

Closed ebmarquez closed 3 years ago

ebmarquez commented 3 years ago

Issue Type: Bug

Format document in Powershell 7 is removing comments and removing the correct whitespace. image

Extension version: 2020.6.0 VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:34:46.910Z) OS version: Windows_NT x64 10.0.17763

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz (56 x 2400)| |GPU Status|2d_canvas: unavailable_software
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: disabled_off
protected_video_decode: disabled_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software| |Load (avg)|undefined| |Memory (System)|511.91GB (491.09GB free)| |Process Argv|D:\\Repo\\Test-NetStack --crash-reporter-id 01a65352-93a6-404d-8779-9b0fa792639f| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsins829:30139715 vsliv368:30146709 vsreu685:30147344 vspor879:30202332 vspor708:30202333 vspor363:30204092 ```
ebmarquez commented 3 years ago

Logs 1608573868-ebc622b5-5302-4c27-9f32-f845e03ff7e71608573277204.zip

bergmeister commented 3 years ago

I believe this is a bug that is already fixed in PSSA 1.19.1 that only ships in the preview extension at the moment but not the stable extension yet. Please run Install-Module PSScriptAnalyzer -Scope CurrentUser -Force in the integrated PowerShell terminal and restart the integrated terminal or VS-Code. After this I'd expect if to be fixed. Please confirm

iamshital commented 3 years ago

I believe this is a bug that is already fixed in PSSA 1.19.1 that only ships in the preview extension at the moment but not the stable extension yet. Please run Install-Module PSScriptAnalyzer -Scope CurrentUser -Force in the integrated PowerShell terminal and restart the integrated terminal or VS-Code. After this I'd expect if to be fixed. Please confirm

This fixed my issue! Nice!!