fix collapsing of multiline components and rsx!{} calls (#2849)
This commit is contained in:
1 parent
40dc14389e
commit
c21b44a4e6
5 files changed
+48
-13
No files matched your search
@@ -118,7 +118,12 @@ pub fn try_fmt_file(
|
||||
let body_is_solo_expr = body.body.roots.len() == 1
|
||||
&& matches!(body.body.roots[0], BodyNode::RawExpr(_) | BodyNode::Text(_));
|
||||
|
||||
if formatted.len() <= 80 && !formatted.contains('\n') && !body_is_solo_expr {
|
||||
// If it's short, and it's not a single expression, and it's not empty, then we can collapse it
|
||||
if formatted.len() <= 80
|
||||
&& !formatted.contains('\n')
|
||||
&& !body_is_solo_expr
|
||||
&& !formatted.trim().is_empty()
|
||||
{
|
||||
formatted = format!(" {formatted} ");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user