Slightly better breaking of unary prefix symbols.#2388
Open
jordwalke wants to merge 7 commits intoreasonml:masterfrom
Open
Slightly better breaking of unary prefix symbols.#2388jordwalke wants to merge 7 commits intoreasonml:masterfrom
jordwalke wants to merge 7 commits intoreasonml:masterfrom
Conversation
Summary:
Before these would break like:
```
!!
myFunction(
foo,
bar
)
```
But now they break like
```
!!myFunction(
foo,
bar
)
```
This is still not ideal, but it's an improvement.
Also, one downside is that now broken nots are not aligned to two characters.
```
let res =
!myFunction(
foo,
bar
)
```
However, I think that is better than what was there previously.
```
let res =
!
myFunction(
foo,
bar
)
```
This doesn't come up with unary minus, or even unary operators that are of
character length two. It's mostly about `!`. I'd say this is still an
improvement.
To fix the remaining issue seems pretty invasive at the moment.
For a better fix, 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).
Test Plan:
Reviewers:
CC:
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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).