Repository navigation
Keep the } of a Stroustrup record copy and the ) of a call at their indent after a comment - #3565
Merged
Merged
Conversation
A comment after the last field of a Stroustrup record copy left the closing brace one indent too deep, and a comment after the argument of a call, with another one before it, left the closing parenthesis under the argument. Both closed with a plain unindent followed by sepNlnUnlessLastEventIsNewline. That reuses the newline the comment wrote, and a newline is indented when it is written: the unindent after it never reached the line, so the bracket stayed at the indent from before. unindentWithTriviaAwareness moves the comment's newline past its UnIndentBy, so the line after the comment starts at the unindented column. Fixes fsprojects#3564
} of a Stroustrup record copy and the ) of a call at their indent after a comment
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.
A comment at the end of a bracketed block, after the last field of a record copy or after the argument of a call, left the closing bracket one indent too deep: at the comment's column, instead of where it goes when there is no comment. The result compiled, so only the layout was wrong. 8.1.0 has the same bug, as #3564 shows.
Fixes #3564
What changes for you
The
-lines arev9.0at 940bae9, the+lines this pull request at 6fcd929.A record copy in Stroustrup style
let updated = { someRecordValue with FieldNumberOne = 1 FieldNumberTwo = 2 // trailing comment - } +}An anonymous record copy,
{| someRecordValue with ... |}, changes the same way.A call whose argument has a comment before and after it
let app = builder.UseUrls( // the public endpoint url // the end of the arguments - ) + )A call with only the comment after its argument already kept
)at the column of the call, and still does.