mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-26 22:20:19 +00:00
fix: adjust padding on autofmt
This commit is contained in:
parent
0b110075ef
commit
3945928c59
3 changed files with 25 additions and 6 deletions
|
@ -135,16 +135,16 @@ impl Writer<'_> {
|
|||
|
||||
total += match &attr.attr {
|
||||
ElementAttr::AttrText { value, name } => {
|
||||
value.source.as_ref().unwrap().value().len() + name.span().line_length() + 3
|
||||
value.source.as_ref().unwrap().value().len() + name.span().line_length() + 6
|
||||
}
|
||||
ElementAttr::AttrExpression { name, value } => {
|
||||
value.span().line_length() + name.span().line_length() + 3
|
||||
value.span().line_length() + name.span().line_length() + 6
|
||||
}
|
||||
ElementAttr::CustomAttrText { value, name } => {
|
||||
value.source.as_ref().unwrap().value().len() + name.value().len() + 3
|
||||
value.source.as_ref().unwrap().value().len() + name.value().len() + 6
|
||||
}
|
||||
ElementAttr::CustomAttrExpression { name, value } => {
|
||||
name.value().len() + value.span().line_length() + 3
|
||||
name.value().len() + value.span().line_length() + 6
|
||||
}
|
||||
ElementAttr::EventTokens { tokens, name } => {
|
||||
let location = Location::new(tokens.span().start());
|
||||
|
@ -164,7 +164,7 @@ impl Writer<'_> {
|
|||
self.cached_formats[&location].len()
|
||||
};
|
||||
|
||||
len + name.span().line_length() + 3
|
||||
len + name.span().line_length() + 6
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,5 +36,6 @@ twoway![
|
|||
messy_indent,
|
||||
long_exprs,
|
||||
ifchain_forloop,
|
||||
t2
|
||||
t2,
|
||||
reallylong
|
||||
];
|
||||
|
|
18
packages/autofmt/tests/samples/reallylong.rsx
Normal file
18
packages/autofmt/tests/samples/reallylong.rsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
pub static Icon3: Component<()> = |cx| {
|
||||
cx.render(rsx!(svg { class: "w-6 h-6",
|
||||
stroke_linecap: "round",
|
||||
fill: "none",
|
||||
stroke_linejoin: "round",
|
||||
stroke_width: "2",
|
||||
stroke: "currentColor",
|
||||
view_box: "0 0 24 24",
|
||||
path {
|
||||
d: "M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2",
|
||||
}
|
||||
circle {
|
||||
cx: "12",
|
||||
cy: "7",
|
||||
r: "4",
|
||||
}
|
||||
}))
|
||||
};
|
Loading…
Reference in a new issue