1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-29 19:47:45 +00:00

Allow tabs and spaces

This commit is contained in:
Vladimir Feisov 2024-11-12 23:45:20 +01:00 committed by Kevin Amado
parent 04fe4d17dc
commit d961847646
8 changed files with 59 additions and 1 deletions

View file

@ -22,6 +22,7 @@ pub(crate) struct BuildCtx {
pub pos_old: crate::position::Position,
pub path: String,
pub vertical: bool,
pub indent: String,
}
pub(crate) fn build(
@ -99,7 +100,7 @@ fn build_step(
add_token(
builder,
rnix::SyntaxKind::TOKEN_WHITESPACE,
&format!("{0:<1$}", "", 2 * build_ctx.indentation),
&build_ctx.indent.repeat(build_ctx.indentation),
);
}
}

View file

@ -39,6 +39,7 @@ pub fn in_memory(
path,
pos_old: crate::position::Position::default(),
vertical: true,
indent,
};
let after = crate::builder::build(&mut build_ctx, ast.node().into())

View file

@ -0,0 +1,6 @@
{
foo =
bar:
baz:
fnbody;
}

View file

@ -0,0 +1,4 @@
{
foo = bar: baz:
fnbody;
}

View file

@ -0,0 +1,11 @@
{
a = rec {
a = {
a = rec {
a = {
a = rec {a = {a = rec {a = {a = rec {a = {};};};};};};
};
};
};
};
}

View file

@ -0,0 +1,11 @@
{
a = rec {
a = {
a = rec {
a = {
a = rec {a = {a = rec {a = {a = rec {a = {};};};};};};
};
};
};
};
}

View file

@ -0,0 +1,11 @@
[
# over indented
1
# under indented
2
# no indentation
[1 2]
[
1 2 3
]
]

View file

@ -0,0 +1,13 @@
[
# over indented
1
# under indented
2
# no indentation
[1 2]
[
1
2
3
]
]