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

feat: inline end at

This commit is contained in:
Kevin Amado 2022-02-18 12:14:03 -05:00
parent 4a7a938e8d
commit fa8d747441
No known key found for this signature in database
GPG key ID: FFF341057F503148
3 changed files with 19 additions and 5 deletions

View file

@ -20,6 +20,19 @@ Types of changes
### Changed
- Let-in expressions are now indented in the top-level of a file.
- Patterns avoid a new line after `@`:
```nix
- args @
- {
+ args @ {
```
```nix
- }
- @ inp:
+ } @ inp:
```
## [0.2.0] - 2022-02-17

View file

@ -174,11 +174,13 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element));
// /**/
let mut comment = false;
children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
comment = true;
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
});
@ -186,11 +188,11 @@ pub fn rule(
// @ x
if let Some(child) = children.peek_next() {
if let rnix::SyntaxKind::NODE_PAT_BIND = child.element.kind() {
if !has_comments && items_count <= 1 {
steps.push_back(crate::builder::Step::Whitespace);
} else {
if comment {
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
} else {
steps.push_back(crate::builder::Step::Whitespace);
}
match layout {
crate::config::Layout::Tall => {

View file

@ -9,8 +9,7 @@
self,
gomod2nix,
mach-nix,
}
@ inp:
} @ inp:
_)
({}: _)
({ a }: _)