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
{{ message }}
Repository navigation
Lines unaffected from sytax errors get formatted wrong on PowerShell 5 #1813
Hi xmrv thanks for opening this issue! We are aware of some of these bugs with and will mark up for grabs. Fortunately this does not seem to repro in PowerShell 7.
Thanks for the detailed and minimal repro. I can confirm this happens only in Windows PowerShell. When narrowing it down further it's the CheckOperator option of PSUseConsistentWhitespace. You could turn this option off as a workaround or set powershell.codeFormatting.whitespaceAroundOperator to false as a VS-Code setting or like you said use PowerShell 7.
I am interested to look at this at some point but due to low impact and scenario (invalid syntax) it's not a priority to investigate further. What I suspect is happening is that the PowerShell parser (on which PSSA relies on) got improved for edge cases like that to be more robust to invalid syntax) and that's probably what we see here.
Activity
StevenBucher98 commentedon Jul 20, 2022
Hi xmrv thanks for opening this issue! We are aware of some of these bugs with and will mark up for grabs. Fortunately this does not seem to repro in PowerShell 7.
bergmeister commentedon Aug 30, 2022
Thanks for the detailed and minimal repro. I can confirm this happens only in Windows PowerShell. When narrowing it down further it's the
CheckOperatoroption ofPSUseConsistentWhitespace. You could turn this option off as a workaround or setpowershell.codeFormatting.whitespaceAroundOperatortofalseas a VS-Code setting or like you said use PowerShell 7.I am interested to look at this at some point but due to low impact and scenario (invalid syntax) it's not a priority to investigate further. What I suspect is happening is that the PowerShell parser (on which PSSA relies on) got improved for edge cases like that to be more robust to invalid syntax) and that's probably what we see here.