-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
CLI option to format non-singleton lists on one line #206
Comments
MattSturgeon
changed the title
CLI option to format non-singleton lists on one line where possible
Jun 4, 2024
--single-line-lists
option to format non-singleton lists on one line where possible
MattSturgeon
changed the title
CLI option to format non-singleton lists on one line where possible
CLI option to format non-singleton lists on one line
Jun 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
In the same spirit as
--width
(default 100) allowing end-users outside of nixpkgs to tweak nixfmt's behavior, I'd like an option to disable the default formatting of non-singleton lists.When the option is enabled, lists of any element count should be rendered on a single line unless that cannot be done for some other reason, such as comments within the list or the total line length being too long.
Better yet, a granular
--max-list-items
option could be added:Small example input
Expected output
Actual output
Note: Only the
short
list and the short list with a long name should be formatted differently when--single-line-lists
is used.Related
This is essentially the opposite of #136 which was asking to revert d2e8575
The text was updated successfully, but these errors were encountered: