-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Change formatting for ++
, +
and //
#284
base: master
Are you sure you want to change the base?
Conversation
This commit implements a new formatting style for `++`, `+` and `//`, like described in proposal 2 in the comment #228 (comment)
Nixpkgs diff processing.. Will be available here |
(reviewed together with @Sereja313 in the meeting) Problematic cases that are valid with the PR: {
foo = aaaaaaaaaaaaaaaaaaaaaaaaa
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ ccccccccccccccccccccccccccccc
+ ddddddddddddddddddddddddddddd;
bar = "aaaaaaaaaaaaaaaaaaaaaaaa"
+ bbbbbbbbbbbbbbbbbbbbbbbbbbb
+ ccccccccccccccccccccccccccc
+ ddddddddddddddddddddddddddd;
} {
boot.kernelParams = [ aaaaaaaaaaaaaa ]
++ optionals config.boot.vesa [
"vga=0x317"
"nomodeset"
];
} {
foo = [ bar ]
++ baz;
} Should address these, can use the above as tests. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/formatting-team-meeting-2025-02-18/60511/1 |
Oh and forgot to mention, we also need to update the standard document with this change. |
9272590
to
7d36f5e
Compare
-- If none of these failed, put together and return | ||
return (preRendered ++ prioRendered ++ postRendered) | ||
where | ||
-- Special case where list concatenation doesn't fit one line we need to replace space with newline | ||
fixListConcat (Spacing Space : xs@(Text _ _ _ "++" : _)) = newline <> xs |
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.
Please don't. This is a strong violation of layers and really should be fixed earlier in the data flow
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.
Yeah, it doesn't work anyway
If you want to remove the indentation, you need to move the To add context, your current code only works for cases where the first term gets absorbed into the line of the foo =
some function application that kinda is long
++ [
a
list
]; Also, don't forget to test cases where the
|
A bit messy notes from the meeting today:
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/formatting-team-meeting-2025-03-18/61868/1 |
This commit implements a new formatting style for
++
,+
and//
, like described in proposal 2 in the comment #228 (comment)