Slightly better breaking of unary prefix symbols. #2388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Before these would break like:
But now they break like
This is still not ideal, but it's an improvement.
Also, one downside is that now closing parens next to unary
!are not aligned to two character grid, though they are still correctly "lined up" with their function call.However, I think that is better than what was there previously.
Unary minus and friends are also improved.
Is now:
Unary minus doesn't have any two character grid problems because there is always a space after them. It's mostly about
!and I'd say this is still an improvement.To fix the remaining issue seems pretty invasive at the moment.
For a future improvement, I might suggest a pass that prepends unary operators to
function names in certain cases, and then running the printer as if these unary
prefixes didn't even exist (in those cases).