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

fix: pattern comments

This commit is contained in:
Kevin Amado 2022-02-09 21:04:06 -05:00
parent 825b08bcb5
commit 4c1f4644ec
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 105 additions and 5 deletions

View file

@ -92,11 +92,8 @@ pub fn rule(
steps.push_back(crate::builder::Step::Pad);
}
children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
children.drain_comment(|text| {
steps.push_back(crate::builder::Step::Comment(text));
});
if let rnix::SyntaxKind::TOKEN_COMMA

View file

@ -74,4 +74,43 @@
({ a ? null }: _)
({ /*a*/ b /*a*/ ? /*a*/ null /*c*/ , /*d*/ e /*a*/ ? /*a*/ null /*f*/ , /*g*/ ... /*h*/ }: _)
({
/*a*/
#
b
/*a*/
#
?
/*a*/
#
null
/*c*/
#
,
/*d*/
#
e
/*a*/
#
?
/*a*/
#
null
/*f*/
#
,
/*g*/
#
...
/*h*/
#
}
/*i*/
#
:
/*j*/
#
_
)
]

View file

@ -1094,4 +1094,68 @@
}:
_
)
(
{
/*
a
*/
#
b
/*
a
*/
#
?
/*
a
*/
#
null
/*
c
*/
#
,
/*
d
*/
#
e
/*
a
*/
#
?
/*
a
*/
#
null
/*
f
*/
#
,
/*
g
*/
#
...
/*
h
*/
#
}
/*
i
*/
#
:
/*
j
*/
#
_
)
]