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

fix: stable let in

- I was using the previous position to compute the new
  position, but this causes the let in to not converge
  into a single round
- This way let in converge into a single round, as promised
  in the README
This commit is contained in:
Kevin Amado 2022-02-06 20:15:30 -05:00
parent c5856f7625
commit 50b2edb882
No known key found for this signature in database
GPG key ID: FFF341057F503148
2 changed files with 7 additions and 4 deletions

View file

@ -20,9 +20,12 @@ impl Children {
for child in node.children_with_tokens() {
match child {
rnix::SyntaxElement::Node(_) => {
children
.push(Child { element: child, pos: pos.clone() });
rnix::SyntaxElement::Node(node) => {
children.push(Child {
element: node.clone().into(),
pos: pos.clone(),
});
pos.update(&node.text().to_string());
}
rnix::SyntaxElement::Token(token) => {
match token.kind() {

View file

@ -82,7 +82,7 @@ pub fn rule(
// in
let child = children.get_next().unwrap();
let indent = child.pos.column > 1;
let indent = build_ctx.pos_new.column > 1;
match layout {
crate::config::Layout::Tall => {
steps.push_back(crate::builder::Step::Dedent);