mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix table indentation and newline issues with new value formatter
This commit is contained in:
parent
395c36fa8b
commit
bfb89dec01
1 changed files with 10 additions and 1 deletions
|
@ -52,6 +52,7 @@ pub(crate) fn format_value_recursive(
|
|||
} else {
|
||||
writeln!(buffer, "{}", STYLE_DIM.apply_to("{"))?;
|
||||
|
||||
let mut is_empty = true;
|
||||
for res in t.clone().pairs::<LuaValue, LuaValue>() {
|
||||
let (key, value) = res.expect("conversion to LuaValue should never fail");
|
||||
let formatted = if let Some(plain_key) = lua_value_as_plain_string_key(&key) {
|
||||
|
@ -75,10 +76,18 @@ pub(crate) fn format_value_recursive(
|
|||
)
|
||||
};
|
||||
buffer.push_str(&formatted);
|
||||
buffer.push('\n');
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
visited.remove(&LuaValueId::from(t));
|
||||
write!(buffer, "\n{}", STYLE_DIM.apply_to("}"))?;
|
||||
write!(
|
||||
buffer,
|
||||
"{}{}{}",
|
||||
INDENT.repeat(depth),
|
||||
if is_empty { " " } else { "" },
|
||||
STYLE_DIM.apply_to("}")
|
||||
)?;
|
||||
}
|
||||
} else {
|
||||
let prefer_plain = depth == 0;
|
||||
|
|
Loading…
Reference in a new issue