-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
printer: Simplify the formatting of single-line lists.
This change splits out the formatting of simple single-line lists. A list is considered "simple" if all of its elements are on one line, all elements are literals (except heredoc) and there are no line comments. As an exception, a heredoc string is allowed when it is the only element in the list. This fixes an issue with a single-line list with one element and a line comment. The formatter used to pull the closing bracket on the same line (after the comment), causing parse errors.
- Loading branch information
Showing
4 changed files
with
107 additions
and
93 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
foo = [1, # Hello | ||
foo = [ | ||
1, # Hello | ||
2, | ||
] | ||
|
||
foo = [1, # Hello | ||
foo = [ | ||
1, # Hello | ||
2, # World | ||
] | ||
|
||
foo = [ | ||
1, # Hello | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ foo = [1, # Hello | |
foo = [1, # Hello | ||
2, # World | ||
] | ||
|
||
foo = [1, # Hello | ||
] |