-
Notifications
You must be signed in to change notification settings - Fork 656
fix(rome_js_formatter): 🐛 preserve new-lines after directives #2500
Conversation
!bench_formatter |
Formatter Benchmark Results
|
It seems that I became a core contributor, |
I think it was a mistake of mine. I didn't know contributors could run bench tests, which is great! Although compliance tests can't be, that one I know 🤣 |
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.
The end result is what we needed! I would suggest the following change.
We already have a logic that checks the presence of lines between nodes:
https://github.com/rome/tools/blob/main/crates/rome_formatter/src/format_element.rs#L828-L844
My suggestion is to make this function public and use this one instead. The reason why we should factor out this function is because it's becoming a recurrent pattern that is used in multiple cases.
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.
Thank you for your contribution!
Summary
Fix #2437
Test Plan
The updated snapshot should fix related issue #2437,
you could review the snapshot this pr updated.