1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 04:57:44 +00:00

continue lambda on the same line

This commit is contained in:
Kevin Amado 2022-02-18 16:54:05 -05:00
parent 5e20ba2efb
commit e7090a0494
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 50 additions and 33 deletions

View file

@ -65,23 +65,7 @@ pub fn rule(
let child = children.get_next().unwrap(); let child = children.get_next().unwrap();
match layout { match layout {
crate::config::Layout::Tall => { crate::config::Layout::Tall => {
if is_pattern_type if comment
|| comment
|| (matches!(
child.element.kind(),
rnix::SyntaxKind::NODE_LAMBDA
) && matches!(
child
.element
.clone()
.into_node()
.unwrap()
.children()
.next()
.unwrap()
.kind(),
rnix::SyntaxKind::NODE_PATTERN
))
|| !matches!( || !matches!(
child.element.kind(), child.element.kind(),
rnix::SyntaxKind::NODE_ATTR_SET rnix::SyntaxKind::NODE_ATTR_SET

View file

@ -16,4 +16,21 @@
{ }: { }:
a: b: c: a: b: c:
a) a)
({pkgs, ...}: {
# Stuff
})
({pkgs, ...}: let
in pkgs)
(a: {b,
...}: c: {
# Stuff
})
(a: {b, c,
...}: d: {
# Stuff
})
] ]

View file

@ -4,14 +4,12 @@
c c
*/ */
d) d)
({}: ({}: b:
b:
/* /*
c c
*/ */
d) d)
(a: (a: {}:
{}:
/* /*
c c
*/ */
@ -48,8 +46,26 @@
locationsXml, locationsXml,
}: }:
null) null)
(a: b: c: (a: b: c: {}: a: b: c:
{}:
a: b: c:
a) a)
({pkgs, ...}: {
# Stuff
})
({pkgs, ...}: let
in
pkgs)
(a: {b, ...}: c: {
# Stuff
})
(a: {
b,
c,
...
}: d: {
# Stuff
})
] ]