-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve semicolons between call expressions and dead lambdas. #276
Conversation
This addresses #262 if I'm not mistaken? |
I'm going to import this so it's easier to review and test it on our repo. |
@cgrushko has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
prevLeaf is KtContainerNodeForControlStructureBody && | ||
prevLeaf.text.isEmpty()) { | ||
return false | ||
} | ||
val nextConcreteSibling = element.getNextSiblingIgnoringWhitespaceAndComments() | ||
if (prevConcreteSibling is KtCallExpression && nextConcreteSibling is KtLambdaExpression) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment with an example that this clause catches? it makes it easier to navigate the code afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
It's possible that removing such semicolons can change the behaviour of the code by reinterpreting the dead lambda as a trailing lambda. This change also improves semicolon preservation when there are comments and whitespace adjacent to the semicolon.
@cgrushko has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
It's possible that removing such semicolons can change the behaviour of the code by reinterpreting the dead lambda as a trailing lambda.