Skip to content

codeFormatting.whitespaceBetweenParameter setting causing characters to be dropped from scripts #1529

Closed
@sbrp

Description

@sbrp

Issue Type: Bug

If "powershell.codeFormatting.whitespaceBetweenParameter" is set to "true", running the auto formatter will result in loss of some characters from scripts.

E.g.
Write-Host "##vso[task.setvariable variable=$VariableName;]$VariableValue"

Becomes
Write-Host "##vso[task.setvariable variable=$VariableName;$VariableValue"
Note the loss of the "]"

If the setting is commented out in settings.json or you set it to "false", the formatter behaves properly.

This also happens with the PowerShell Preview extension.

Extension version: 2020.6.0
VS Code version: Code 1.46.0 (a5d1cc28bb5da32ec67e86cc50f84c67cc690321, 2020-06-10T09:03:20.462Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz (8 x 1992)
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: enabled
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) 7.89GB (1.27GB free)
Process Argv
Screen Reader no
VM 0%

Activity

bergmeister

bergmeister commented on Jun 17, 2020

@bergmeister
Collaborator

@sbrp Thank you for taking the time to provide details. This is a new setting that we recently added and its default is false. This issue has already been fixed as part of #1498 but is pending a patch release of PSScriptAnalyzer, which we plan to do in the next few weeks. In the meantime we suggest to set the setting value to its default value of false.
FYI @rjmholt @JamesWTruher @SydneyhSmith

ghost closed this as completedon Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bergmeister@sbrp

        Issue actions

          codeFormatting.whitespaceBetweenParameter setting causing characters to be dropped from scripts · Issue #1529 · PowerShell/PSScriptAnalyzer