Repository navigation
Add opt-in matching-parenthesis line breaks - #415
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal: #417.
I’d like to propose
--matching-paren-newlineto make the end of multiline lists and subqueries easier to spot.When formatted content starts on a new line after
(, the option puts the matching)on its own line, aligned with the opening line. Each nested pair follows the same rule. It’s disabled by default, since this is a style preference.INSERT column list (
-Bin both examples, all other formatting options at their defaults):Before:
With
--matching-paren-newline:Subquery (default formatting options):
Before:
With
--matching-paren-newline:Procedural condition with the option enabled:
I ran
prove -l t/and the larger SQL corpus withperl t/regress_test.pl; both pass. The existing expected-output files stay unchanged with the option disabled. The new tests also check that repeated formatting is stable.Would you be open to this option? I’d welcome your thoughts on the name and behavior. Feel free to close this PR if the option isn’t something you’d like to support.