-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ternary expression formatting
- In `AlignTernaryOperators`, when operators are aligned with an expression that breaks over multiple lines, align with the first token on the previous line (like in `AlignChains` and `AlignArrowFunctions`) - To better reflect operator precedence and associativity in chained ternary expressions--whether unambiguous (e.g. `1 ? 2 ? 3 : 4 : 5`) or deprecated (e.g. `1 ? 2 : 3 ? 4 : 5`)--stop iterating over previous siblings in `TokenUtil::getTernaryContext()` when a ternary expression with expr2 is found - Make equivalent changes to `TokenUtil::getTernaryEndExpression()` - Add and adopt `TokenUtil::getTernaryExpression()` - Add `TokenUtil::getPrecedenceOf()` - Add `Token::hasNewlineAfterPrevCode()` - Add `TokenCollection::isEmpty()` - Add alignment callbacks to token data and use them to re-align ternary operators after hanging indentation is collapsed - Fix issue where ternary expressions are incorrectly aligned across logical operator boundaries - Add tests
- Loading branch information
Showing
10 changed files
with
739 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.