-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting of trailing comments in composites
Previously trailing comments inside arrays, objects, and sets were not being formatted correctly. For example: [ 1, 2, # foo ] Would result in: [ 1, 2, # foo ] The problem was that when the sequence was ended, the comments were not being emitted. As a result when the comments were finally emitted, the indenting was wrong and the state of the formatter was not consistent (and so the closing bracket appeared on the same line the comment.) These changes modify the formatter to emit the comments when ending the sequence, as that's the point where the indenting state is known. Also, as part of these changes, the fix for extra newlines (#1032) has been modified. Instead of changing the startLine and endLine behaviours (which are a bit sensitive) we just squash trailing newlines at the end of the formatting process. Fixes #1060 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information
Showing
4 changed files
with
42 additions
and
14 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