diff --git a/CHANGELOG.md b/CHANGELOG.md index fedfa2e..8b9d34b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,28 +7,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + + +### Changed + +- Let-in expressions are now indented in the top-level of a file. + ## [0.2.0] - 2022-02-17 ### Added +- A `--version` flag to the CLI. - Pre-built binaries for x86_64-linux and aarch64-linux. +- Support for inline comments on lists, attr-sets, and let-in expressions. + +### Changed + - Made the logic of the `or-default` (`a or b`) node to be equal to the binary operator (`a $operator b`). This increases consistency across the same family of elements. -- Remove users freedom to insert newlines +- Reduce 1 indentation level in `let-in` expressions, + when the target expression is a parenthesis, attr-set, list, or string. +- String interpolations in multi-line strings + now have a nice-looking indentation. + +### Removed + +- Users freedom to insert newlines before the `?` in pattern bindings (`a ? b`). Inserting a newline after the `?` is still possible. This increases consistency on where to break a long pattern binding. -- Remove space on empty containers (`[]`, `{}`). -- Add a `--version` flag to the CLI. -- Reduce 1 indentation level in `let-in` expressions, - when the target expression is a parenthesis, attr-set, list, or string. -- Support inline comments on lists, attr-sets, and let-in expressions. -- String interpolations in multi-line strings - now have a nice-looking indentation. +- Space on empty containers (`[]`, `{}`). ### Fixed diff --git a/src/rules/let_in.rs b/src/rules/let_in.rs index 14bc123..601cb68 100644 --- a/src/rules/let_in.rs +++ b/src/rules/let_in.rs @@ -102,7 +102,6 @@ pub fn rule( // in let child_in = children.get_next().unwrap(); - let top_level = build_ctx.pos_new.column <= 1; // /**/ let mut child_comments = std::collections::LinkedList::new(); @@ -132,9 +131,7 @@ pub fn rule( { steps.push_back(crate::builder::Step::Whitespace); } else { - if !top_level { - steps.push_back(crate::builder::Step::Indent); - } + steps.push_back(crate::builder::Step::Indent); steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Pad); } @@ -155,9 +152,7 @@ pub fn rule( steps.push_back(crate::builder::Step::FormatWider( child_expr.element, )); - if !top_level { - steps.push_back(crate::builder::Step::Dedent); - } + steps.push_back(crate::builder::Step::Dedent); } crate::config::Layout::Wide => { steps.push_back(crate::builder::Step::Whitespace); diff --git a/tests/cases/let_in/out b/tests/cases/let_in/out index 589efa7..132d882 100644 --- a/tests/cases/let_in/out +++ b/tests/cases/let_in/out @@ -88,5 +88,5 @@ let 2 ]; in -/**/ -a + /**/ + a