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:
parent
4a7a938e8d
commit
fa8d747441
3 changed files with 19 additions and 5 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -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
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
self,
|
||||
gomod2nix,
|
||||
mach-nix,
|
||||
}
|
||||
@ inp:
|
||||
} @ inp:
|
||||
_)
|
||||
({}: _)
|
||||
({ a }: _)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue