fix: Null coalescing not own its line with complex left-hand side#1770
Conversation
belav
left a comment
There was a problem hiding this comment.
Looks good, I'm just waiting on my script to create a PR on https://github.com/belav/csharpier-repos/pulls to see if there are any edge cases you may have missed.
|
Upon reviewing the PR that was created, I noticed there are some oversights. I'll work on the corrections later. |
472f5dc to
80f1178
Compare
|
After reviewing the results in the csharpier-repos, I have added support for the following:
|
|
@belav |
|
Taking a look at the changes it made I think everythink looks good except this one - belav/csharpier-repos@e097ff1#diff-bb147afabd02afcf48b4b4c09aad50f6bb117fea0bae21a1b2f1adef34f16beb Your first pass had I don't see a test case for it which is probably why it ended up being undone. Was there something specific you didn't think was an improvement? I do like the way it groups it with the ending paren |
|
Ideally I'd have an action for doing the formatting on csharpier-repos - I think I attempted it a while back and it wasn't super straightforward. |
1fe8361 to
8ec1e94
Compare
|
Added support for when the leftmost element is a parenthesized expression. |
There was an issue where if the left-hand side of `??` was even slightly complex, the right-hand side would become part of the group and could not have its own line. The grouping conditions were reviewed and changed from a threshold-based determination of left-hand side complexity to condition limited to cases where: - "The left-hand side is an InvocationExpression and consists solely of MemberAccessExpressions that do not contain InvocationExpressions" OR - "The left-hand side is a ParenthesizedExpression".
8ec1e94 to
abcf5d8
Compare
There was an issue where if the left-hand side of
??was even slightly complex, the right-hand side would become part of the group and could not have its own line.I reconsidered the conditions for grouping and changed it from judging the complexity of the left-hand side by a threshold to a condition where "the left-hand side is an InvocationExpression and consists solely of MemberAccessExpression that does not include an InvocationExpression".
fix #1769