This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 666
feat(rome_js_formatter): assignment expressions with layout #2728
Merged
Conversation
This file contains 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
Deploying with Cloudflare Pages
|
ematipico
force-pushed
the
feature/assignment-chain
branch
from
June 17, 2022 15:42
67aba63
to
20ed4ff
Compare
ematipico
commented
Jun 17, 2022
crates/rome_js_formatter/tests/specs/prettier/js/assignment/chain-two-segments.js.snap
Outdated
Show resolved
Hide resolved
denbezrukov
reviewed
Jun 17, 2022
denbezrukov
reviewed
Jun 17, 2022
MichaReiser
approved these changes
Jun 20, 2022
MichaReiser
approved these changes
Jun 20, 2022
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.
Looking good. Can you add our metrics to the test plan?
Done! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
This PR closes #2416
This PR adds
Chain
andChainTail
to the list of layouts and implements them. I left out on purposeChainTailArrowFunction
to not add too code, mostly because this PR moves code around and it might cause some confusion.I moved the implementation of
write_assignment_like
inside theformat
function ofJsAnyAssignmentLike
for two important reasons:JsAnyAssignmentLike
variants in order to understand whether a group should be added or not;JsAnyAssignmentLike
, which was needed for the implementation of the new layout;I also moved few functions inside the struct itself, because they needed to be exposed. The only loose function is used else where, so I kept there.
Test Plan
I created two new tests for the new layouts, one case where the groups breaks and on where it doesn't.
PR
File Based Average Prettier Similarity: 74.79%
Line Based Average Prettier Similarity: 69.89%
main
File Based Average Prettier Similarity: 74.65%
Line Based Average Prettier Similarity: 69.75%