1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-31 12:37:45 +00:00

feat: expand multi-item let-in

This commit is contained in:
Kevin Amado 2022-01-31 21:02:03 -05:00
parent b61724a5a4
commit 41ff5e9b8b
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 21 additions and 0 deletions

View file

@ -6,8 +6,20 @@ pub fn rule(
let mut children = crate::children::Children::new(build_ctx, node);
let items_count = node
.children()
.filter(|element| match element.kind() {
rnix::SyntaxKind::NODE_KEY_VALUE
| rnix::SyntaxKind::NODE_INHERIT
| rnix::SyntaxKind::NODE_INHERIT_FROM => true,
_ => false,
})
.count();
let layout = if children.has_comments() {
&crate::config::Layout::Tall
} else if items_count > 1 {
&crate::config::Layout::Tall
} else {
build_ctx.config.layout()
};

View file

@ -1,4 +1,6 @@
let
/**/
a = let b=2; c=3; in d;
/**/
a = let c=1; in f;
/**/

View file

@ -1,5 +1,12 @@
let
/**/
a =
let
b = 2;
c = 3;
in
d;
/**/
a = let c = 1; in f;
/**/
a =