Skip to content

Code Formatting rules don't _allow_ 1TBS #754

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

Closed
Jaykul opened this issue Apr 24, 2017 · 1 comment
Closed

Code Formatting rules don't _allow_ 1TBS #754

Jaykul opened this issue Apr 24, 2017 · 1 comment

Comments

@Jaykul
Copy link
Contributor

Jaykul commented Apr 24, 2017

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 an else or catch or finally ...
  • 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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants