1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 21:17:45 +00:00

Merge pull request #143 from kamadorueda/kamadorueda

feat: continue lambda on the same line
This commit is contained in:
Kevin Amado 2022-02-18 17:08:31 -05:00 committed by GitHub
commit 81ce4c563f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 33 deletions

View file

@ -60,6 +60,19 @@ Types of changes
+ {pkgs, ...}: + {pkgs, ...}:
``` ```
- Pattern matching lambdas now follow the equal sign:
```diff
- fnLocationRelative =
- {
- name,
- value,
- }:
+ fnLocationRelative = {
+ name,
+ value,
+ }:
```
## [0.2.0] - 2022-02-17 ## [0.2.0] - 2022-02-17
### Added ### Added

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,18 +4,16 @@
c c
*/ */
d) d)
({}: ({}: b:
b: /*
/* c
c */
*/ d)
d) (a: {}:
(a: /*
{}: c
/* */
c d)
*/
d)
(a: d) (a: d)
(a: (a:
/* /*
@ -48,8 +46,26 @@
locationsXml, locationsXml,
}: }:
null) null)
(a: b: c: (a: b: c: {}: a: b: c:
{}: a)
a: b: c:
a) ({pkgs, ...}: {
# Stuff
})
({pkgs, ...}: let
in
pkgs)
(a: {b, ...}: c: {
# Stuff
})
(a: {
b,
c,
...
}: d: {
# Stuff
})
] ]