-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
juvix format
line width 100 with ribbon width 100 (#2883)
This PR increases the ribbon width of `juvix format` from 60 to 100 characters. Reasons for the compromise to a fixed 100 chars ribbon width: * It is clear that the ribbon width of 60 characters was too small. * A ribbon width of 100 is an acceptable compromise between formatting code for display and editing code in multiple buffers on the same screen. * We would like to avoid making the formatter configurable so that Juvix code has a consistent look and to save future Juvix users from discussions about formatting. Maxim: "juvix format's style is no one's favourite, yet juvix format is everyone's favourite" (thanks go fmt). ## Definition of ribbon width from the [docs](https://hackage.haskell.org/package/prettyprinter-1.7.1/docs/Prettyprinter.html) > The page has a certain maximum width, which the layouter tries to not exceed, by inserting line breaks where possible. The functions given in this module make it fairly straightforward to specify where, and under what circumstances, such a line break may be inserted by the layouter, for example via the [sep](https://hackage.haskell.org/package/prettyprinter-1.7.1/docs/Prettyprinter.html#v:sep) function. > > There is also the concept of ribbon width. The ribbon is the part of a line that is printed, i.e. the line length without the leading indentation. The layouters take a ribbon fraction argument, which specifies how much of a line should be filled before trying to break it up. A ribbon width of 0.5 in a document of width 80 will result in the layouter to try to not exceed 0.5*80 = 40 (ignoring current indentation depth). Examples from [`anoma-app-patterns:/Token/Transaction.juvix`](https://github.com/anoma/anoma-app-patterns/blob/8d7e892de33159b4b7c59e2cf11282ba49853e71/Token/Transaction.juvix). NB: The file in the repo is unformatted so will not match the layout in the left column below. | Current (line width 150, ribbon width 60) | This PR (line width 100, ribbon width 100) | | --- | --- | | <img width="1000" alt="Screenshot 2024-07-10 at 12 22 46" src="https://github.com/anoma/juvix/assets/92877/108b59bc-4b3d-4b83-a148-bb7069d7bc13"> | <img width="1000" alt="Screenshot 2024-07-10 at 14 41 33" src="https://github.com/anoma/juvix/assets/92877/c3cc2c11-bd45-4a07-84ba-3de3d960e542"> | | <img width="1000" alt="Screenshot 2024-07-10 at 12 23 10" src="https://github.com/anoma/juvix/assets/92877/9f3e2d47-bcac-409a-8b09-12dde5079ec5"> | <img width="1000" alt="Screenshot 2024-07-10 at 14 42 01" src="https://github.com/anoma/juvix/assets/92877/3e20db90-5f62-48e0-ac38-ec357d5baec0"> | | <img width="1000" alt="Screenshot 2024-07-10 at 12 23 21" src="https://github.com/anoma/juvix/assets/92877/995d01a9-d19d-429e-aee4-114a4a40c899"> | <img width="1075" alt="Screenshot 2024-07-10 at 14 42 14" src="https://github.com/anoma/juvix/assets/92877/3cfd1663-75d2-48a3-9e93-c7938cc62a47"> | | <img width="1000" alt="Screenshot 2024-07-10 at 12 23 34" src="https://github.com/anoma/juvix/assets/92877/1623afe4-89a6-4633-86e0-8d4d39e49e93"> | <img width="1000" alt="Screenshot 2024-07-10 at 14 42 29" src="https://github.com/anoma/juvix/assets/92877/813f602f-04b4-4ed5-a21e-4435a58d8515"> | | <img width="1086" alt="Screenshot 2024-07-10 at 12 23 50" src="https://github.com/anoma/juvix/assets/92877/a04d0664-b9d4-46f3-8ea0-72e5ae0660e1"> | <img width="1093" alt="Screenshot 2024-07-10 at 14 42 40" src="https://github.com/anoma/juvix/assets/92877/5cf2328d-b911-4ad9-bcc8-3611f4f89465"> | | <img width="1000" alt="Screenshot 2024-07-10 at 12 24 13" src="https://github.com/anoma/juvix/assets/92877/53053e7a-32e1-440e-9060-1ab15133a934"> | <img width="1058" alt="Screenshot 2024-07-10 at 14 42 57" src="https://github.com/anoma/juvix/assets/92877/7263732e-a2cf-43f3-9d49-0599175a160d"> |
- Loading branch information
1 parent
597824e
commit 4e22743
Showing
22 changed files
with
105 additions
and
222 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
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
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
Oops, something went wrong.