-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't drop comments in collection literals with preserved newlines.
A line comment in a collection literal triggers special formatting where we allow multiple elements in a single line, like: ``` list = [ // Comment. 1, 2, 3 4, 5, 6, ]; ``` The formatter models that by having a DelimitedListBuilder for the entire collection literal. Then the elements that should be packed onto a single line are formatted using a separate DelimitedListBuilder for each line. In the very rare case where you have a comment after the last element on a line but *before* the subsequent comma, the comment would get dropped. This is because the comment was sitting in the inner DelimitedListBuilder for the line waiting to be put somewhere, but we then discard that builder to start a new line or when the whole list is done. This fixes that. Whenever we're done with a line, we hoist any remaining comments up to the outer DelimitedListBuilder. That way the comment gets put after the comma at the end of the line. Also bump the min SDK constraint to 3.4.0. I don't think dart_style works with an older version because of analyzer's SDK constraints. Fix #1584.
- Loading branch information
1 parent
89577e7
commit 914d1d6
Showing
5 changed files
with
491 additions
and
4 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
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
Oops, something went wrong.