-
Notifications
You must be signed in to change notification settings - Fork 385
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
1.18.0 - Incorrect indentation of brace after pipe #1187
Comments
Thanks, very good and concise repro :-) $def = @'
function hello {
if ($true) {
Write-Host "hello"
}
if ($true) {
Write-Host "hello2"
}
}
'@
Invoke-Formatter -ScriptDefinition $def -Settings CodeFormattingOTBS Therefore the problem shows up in this simpler scenario as well: $def = @'
function hello {
if ($true) {
"hello" | Out-Host
}
}
'@
Invoke-Formatter -ScriptDefinition $def -Settings CodeFormattingOTBS I made improvements to the multi-line pipeline indentation behaviour in PSUseConsistentWhiteSpace and added the |
I actually noticed that in VSCode as well. after updating to the newest version when using formatting when it finds pipeline 1 line above, everything under it gets moved closer to the left. |
I guess the best option would be either to set the default setting in the next vscode extension update to |
@bergmeister it seems that option 1 is the fastest so lets go with that. I had snapped some builds already but seeing this I can snap some more. |
Same issue after upgrading to Describe 'test' {
Context 'test' {
It 'test' {
$true | Should -BeTrue
}
It 'test' {
$true | Should -BeTrue
}
It 'test' {
$true | Should -BeTrue
}
}
} |
Seeing this too. It's badly reformatting all my code! Example here is just start of issues in a function. Once things have moved left they stay left all the way to the end of the file
FWIW - the suggested work around of editing |
@DarkLite1 @fatherjack Your cases will be fixed with the next update of the vscode extension, which will change the default setting to Just to give a bit of background in case some people are concerned:
Concluding, it was unfortunate that this happened but at least with this we can protect the user's from it without any noticeable, negative impact, which shows that configurable settings or flags can really be helpful. Unfortunately there are many different cases and unfortunately some special ones are only found once it is in the wild. I hope that in the future, PSSA publishes preview releases (this is not entirely in my hand) and that user's are understandable, the feedback from users is very valuable though and we try to be as response as possible (in 1.17, a patch to the signing problem and a reported NullReferenceException was released only a few days later) |
@bergmeister Hi, thanks for the detailed response. In reference to your points: Do you have any estimate on when the next update of the extension is likely to be please? |
@fatherjack The vscode extension will probably release this week, for editor related issues you can also just uninstall 1.18.0 for the moment |
@bergmeister thanks for the detailed feedback and the work you put into this. It's easy for users to complain if they didn't write the code themselves, I know how that feels. In some languages they have a saying like "you can't make an omelet without breaking eggs". So no worries, I'm sure it gets fixed in the remaining 2 feature flags too, when you or someone else has some time. In the meantime, reverted back to |
Thanks for your understanding. I have a fix for it ready in PR #1191. The next vscode extension update will suppress the bug by changing the default in the editor to |
Steps to reproduce
Expected behavior
This is the output when using 1.17.1
Actual behavior
This is the output when using 1.18.0
Environment data
The text was updated successfully, but these errors were encountered: