Adds whitespace around operators with `whitespaceAroundOperator` set to false in some cases
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
vscode-powershell inserts a space before an operator in some cases, even with:
"powershell.codeFormatting.whitespaceAroundOperator": false
PowerShell Version
> $PSVersionTable Name Value ---- ----- PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.22631 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 > $Host Name : Visual Studio Code Host Version : 2024.0.0 InstanceId : 140baa93-df7a-407d-81bb-095443b84275 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : nb-NO CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.87.0 019f4d1419fbc8219a181fab7892ebccf7ee29a2 x64
Extension Version
ms-vscode.powershell@2024.0.0Steps to Reproduce
Get-Process | ` Sort-Object -Property @{'Expression'={$_.'Name'}} | ` Select-Object -Property @{'Name'='ProcessName';'Expression'={$_.'Name'}}, 'Id'
What it ends up looking like:
Get-Process | ` Sort-Object -Property @{'Expression' ={$_.'Name'}} | ` Select-Object -Property @{'Name'='ProcessName';'Expression'={$_.'Name'}}, 'Id'
Notice it only adds a whitespace after 'Expression' in Sort-Object -Property.
Visuals
No response
Logs
No response