-
Notifications
You must be signed in to change notification settings - Fork 395
powershell.codeFormatting.whitespaceBetweenParameters inappropriately removes + operators in string concatenation #1536
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Reproduces with: Invoke-Formatter -ScriptDefinition 'Write-Output ($env:computername + ", " + $env:username)' -Settings @{
Rules = @{
PSUseConsistentWhitespace = @{
Enable = $true
CheckParameter = $true
}
}
} in PSSA 1.19. Transferring to the PSScriptAnalyzer repo |
Looks like I can unfortunately |
@rjmholt Are you sure you have pulled all changes in? I can reproduce with 1.19.0 but not with the latest version of |
I trust you on this |
keyword
|
The issue has re-appeared in my setup (see below): when I set: "powershell.codeFormatting.whitespaceBetweenParameters": true then "Write-Output ($env:computername + ", " + $env:username)" The formatting does not happen when I set "powershell.codeFormatting.whitespaceBetweenParameters": false The only thing I can think of is that I upgraded to powershell core 7.1 My setup: Name: PowerShell |
Issue Description
When formatting a document with powershell.codeFormatting.whitespaceBetweenParameters enabled, the formatter inappropriately removes + operators in string concatenation.
Steps to reproduce:
Write-Output ($env:computername + ", " + $env:username)
(GitHub is collapsing the whitespace, but there are four spaces on each side of each plus sign)Expected result:
Write-Output ($env:computername + ", " + $env:username)
Actual result:
Write-Output ($env:computername ", " + $env:username)
(which is syntactically invalid!)Additionally, if you start out with the expected result and format the document, you get the following result:
Write-Output ($env:computername ", " $env:username)
...which is even worse, as the operators have been removed entirely.Attached Logs
1593619176-7b7e0c1b-7340-41cb-a9a0-c526c1c513bd1593619173652.zip
editor services.log
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: