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 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rome_formatter):
IndentIfBreak
IR element
This PR adds a new `indent_if_break` IR element that has the same semantics as using `if_group_breaks` with `indent` and `if_group_fits_on_line` ``` write!(f, [ group(&text("Head")).with_group_id(Some(id)), if_group_breaks(&indent(&text("indented"))).with_group_id(Some(id)), if_group_fits_on_line(&text("indented")).with_group_id(Some(id)) ]) ``` The advantage of the new IR is that it simplifies the debug output of the IR and removes the need to memoize the content. ## Tests I added new doc tests and ran `cargo test` to verify that using `indent_if_break` doesn't introduce any regression on existing syntax.
- Loading branch information
1 parent
af4a788
commit ed37d1a
Showing
5 changed files
with
196 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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
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