mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +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:
parent
c5856f7625
commit
50b2edb882
2 changed files with 7 additions and 4 deletions
|
@ -20,9 +20,12 @@ impl Children {
|
||||||
|
|
||||||
for child in node.children_with_tokens() {
|
for child in node.children_with_tokens() {
|
||||||
match child {
|
match child {
|
||||||
rnix::SyntaxElement::Node(_) => {
|
rnix::SyntaxElement::Node(node) => {
|
||||||
children
|
children.push(Child {
|
||||||
.push(Child { element: child, pos: pos.clone() });
|
element: node.clone().into(),
|
||||||
|
pos: pos.clone(),
|
||||||
|
});
|
||||||
|
pos.update(&node.text().to_string());
|
||||||
}
|
}
|
||||||
rnix::SyntaxElement::Token(token) => {
|
rnix::SyntaxElement::Token(token) => {
|
||||||
match token.kind() {
|
match token.kind() {
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub fn rule(
|
||||||
|
|
||||||
// in
|
// in
|
||||||
let child = children.get_next().unwrap();
|
let child = children.get_next().unwrap();
|
||||||
let indent = child.pos.column > 1;
|
let indent = build_ctx.pos_new.column > 1;
|
||||||
match layout {
|
match layout {
|
||||||
crate::config::Layout::Tall => {
|
crate::config::Layout::Tall => {
|
||||||
steps.push_back(crate::builder::Step::Dedent);
|
steps.push_back(crate::builder::Step::Dedent);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue