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

feat: get rec { done right

This commit is contained in:
Kevin Amado 2022-01-29 17:05:05 -05:00
parent d4decc99fa
commit 6a5f456d72
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 15 additions and 3 deletions

View file

@ -19,6 +19,14 @@ pub fn rule(
build_ctx.config.layout() build_ctx.config.layout()
}; };
// rec
let child = children.peek_next().unwrap();
if let rnix::SyntaxKind::TOKEN_REC = child.element.kind() {
steps.push_back(crate::builder::Step::Format(child.element));
steps.push_back(crate::builder::Step::Whitespace);
children.move_next();
}
// { // {
let child = children.get_next().unwrap(); let child = children.get_next().unwrap();
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));

View file

@ -3,5 +3,5 @@
{/*a*/} {/*a*/}
{a=1;} {a=1;}
{/*a*/b=1;/*c*/} {/*a*/b=1;/*c*/}
{a={a={a={a={a={a={a={a={a={a={};};};};};};};};};};} {a=rec {a={a=rec {a={a=rec {a={a=rec {a={a=rec {a={};};};};};};};};};};}
] ]

View file

@ -16,9 +16,13 @@
*/ */
} }
{ {
a = { a = rec {
a = { a = {
a = { a = { a = { a = { a = { a = { a = { a = { }; }; }; }; }; }; }; }; a = rec {
a = {
a = rec { a = { a = rec { a = { a = rec { a = { }; }; }; }; }; };
};
};
}; };
}; };
} }