Repository navigation
fix: keep an array expanded with preferSingleLine when a value on its own line is multi-line - #914
Merged
Merged
Conversation
… own line is multi-line
…le-line-call-stability # Conflicts: # src/generation/generate.rs
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.
Fixes output that changed when formatted a second time with
arrayExpression.preferSingleLine: true. AtlineWidth: 40:was formatted as:
and formatting that again gave:
With
preferSingleLine, the newline after the open bracket doesn't make the array multi-line, and the arguments keep their line breaks, so the second time[call(fits on the first line and the call went beside the brackets. Now the first output is kept, which is also what happens withoutpreferSingleLine. An array written expanded still collapses when it fits on one line, and a multi-line value written beside the brackets stays there.The same is fixed for
tupleType.preferSingleLineandarrayPattern.preferSingleLine, and for the other values that move to their own line when too long (ex.newexpressions, functions with long parameters).Change to output that was stable
With
preferSingleLine, an array written expanded with a value that's always multi-line now stays expanded. For example, this used to go beside the brackets as[function() {:Object and array elements of an array expression still go beside the brackets as before.
Not fixed here
arguments.preferSingleLineandparameters.preferSingleLinehave the same problem. Doing the same there would stop a callback written on its own line from going beside the parens, so I left that alone.