-
Notifications
You must be signed in to change notification settings - Fork 513
Enable code formatter to enforce consistent whitespace style #489
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
src/features/DocumentFormatter.ts
Outdated
@@ -139,6 +139,7 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider | |||
private readonly ruleOrder: string[] = [ | |||
"PSPlaceCloseBrace", | |||
"PSPlaceOpenBrace", | |||
"PSUseWhitespace", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named PSUseConsistentWhitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was in a bit of a limbo on whether to have "consistent" in its name. But looks like "PSUseConsistentWhitespace" sounds more consistent with the "PSUseConsistentIndentation" rule. On the other hand all the rules enforce some or the other kind of consistency and so having the "consistent" word seemed verbose (And I was even thinking of changing "PSUseConsistentIndentation" to "PSUseIndentation", but that would be a breaking change for PSSA). At this point, I personally don't have any preference but if you think "PSUseConsistentWhitespace" sounds better, I can change it to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think consistency would be nice between the two names. "PSUseIndentation/Whitespace" doesn't sound specific enough to me; the "Consistent" designation helps with that. I've tried thinking of other names and I can't come up with anything better at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Also made corresponding changes to PowerShell/PSScriptAnalyzer#702
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks man!
@daviwil Thanks! |
Resolves #446.