-
Notifications
You must be signed in to change notification settings - Fork 403
Description
Despite overwhelming support in the community for the so-called one-true-brace style ...
PoshCode/PowerShellPracticeAndStyle#81
The current options in the code format rules (and thus in VS Code) don't allow enforcing it.
Personally, I think you shouldn't have all these twiddly settings, but just have names for the three main styles, with perhaps an extra option for "un-cuddling" the else, catch, and finally (although this option seems dirty to me, it's obviously more popular than your current defaults of Allman style).
Specifically: "powershell.codeFormatting.newLineAfterCloseBrace": false does not result in the removal of newlines between a close brace and a following condition:
- If you leave this setting at it's default
true, the fixer will add newlines between a closing brace and anelseorcatchorfinally... - If you set this setting to
false, the fixer will not put them back where they should be.
Additionally, setting newLineAfterCloseBrace to false results in ignoring the whitespace between a closing brace and an else, so if I set it, and then manually delete the newlines, the formatter still won't remove all the extra spaces, and I get this:
if($Confirm) {
# Prompt
} else {
# Do Something
}The formatter just ignores all the extra white space...