You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using the "Format Document" command when "powershell.codeFormatting.whitespaceBetweenParameters": true is set, stream redirection operators like 2>&1 from statements like Get-Content "a.txt" 2>&1 > "b.txt" are removed, resulting in Get-Content "a.txt" > "b.txt", which changes what the code does. That should not happen after autoformatting code.
PowerShell Version
Name Value---- -----PSVersion 7.4.3PSEdition CoreGitCommitId 7.4.3OS Microsoft Windows 10.0.19045Platform Win32NTPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}PSRemotingProtocolVersion 2.3SerializationVersion 1.1.0.1WSManStackVersion 3.0Name : Visual Studio Code HostVersion : 2024.2.2InstanceId : a13ae448-bd0c-4cd1-9d1b-e524f257013eUI : System.Management.Automation.Internal.Host.InternalHostUserInterfaceCurrentCulture : cs-CZCurrentUICulture : cs-CZPrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxyDebuggerEnabled : TrueIsRunspacePushed : FalseRunspace : System.Management.Automation.Runspaces.LocalRunspace
Hi, this is/was a bug in PSScriptAnalyzer: PowerShell/PSScriptAnalyzer#2000 the fix has been merged but we're still pending a release (which we'll then need to pull in here) so it'll be fixed soon enough!
Prerequisites
Summary
After using the "Format Document" command when
"powershell.codeFormatting.whitespaceBetweenParameters": true
is set, stream redirection operators like2>&1
from statements likeGet-Content "a.txt" 2>&1 > "b.txt"
are removed, resulting inGet-Content "a.txt" > "b.txt"
, which changes what the code does. That should not happen after autoformatting code.PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
.ps1
fileShift
+Alt
+F
)Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: