-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ternary operator gets formatted to Where-Object #1791
Comments
I face the same issue. Please fix :) |
Looks to me like this is yet-to-be-supported in PSScriptAnalyzer, #1314 |
Looks like this is also relate to #1362 Could you also please confirm the version of PSSA being run by calling |
@SydneyhSmith I don't have any version of PSScriptAnalyzer, but I believe the vscode powershell extension comes with specific version of the PSScriptAnalyzer included, in this case it's 1.20.0, which is executed "somewhere behind the scenes" |
I can reproduce this issue only if I use Windows PowerShell to run something like |
Seems like the latest vscode powershell extension version comes with a breaking change to the setting "powershell.powerShellAdditionalExePaths". It is no longer array but an object, once I adjusted this setting this bug is no longer observable. Previously it was: "powershell.powerShellAdditionalExePaths": [
{
"versionName":"PowerShell 7.2.4",
"exePath":"C:\\ProgramData\\PowerShell\\7.2.4\\pwsh.exe"
}
] Now(the working setting for [email protected]) is: "powershell.powerShellAdditionalExePaths": {
"PowerShell 7.2.4": "C:\\ProgramData\\PowerShell\\7.2.4\\pwsh.exe"
}, |
You are correct @gogbg, more info here: PowerShell/vscode-powershell#3978 So sorry, we took a community PR and did not realize it was a breaking change. |
It seems this issue is still unsolved. It just happened in my editor. I don't get why it was closed. @gogbg |
@lzandman check your vscode config, as I described here #1791 (comment) |
But that is a response from 2022. It looks like a quick workaround/hack to make things work. Does this mean the underlying issue hasn't actually been resolved and this bug is still present in VSCode? |
@lzandman the issue resolved for me when I adjusted the VSCode PowerShell extension version to PowerShell 7.2.4. |
Prerequisites
Summary
I'm experiencing issue with the format document functionality which is incorrectly modifying the
ternary operator(?)
in statements to 'Where-Object'.PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Run the vscode format document (Ctrl+K Ctrl+D)
The output should be
Visuals
Logs
No response
The text was updated successfully, but these errors were encountered: