Skip to content

Commit 681607b

Browse files
committed
perf(formatter): check the Text to see whether it has multiple lines based on its width (#15405)
I forgot to change this in #15372 <img width="1291" height="386" alt="image" src="https://github.com/user-attachments/assets/db7c21f2-81e4-433a-8dae-a69813528af8" />
1 parent b0f43f9 commit 681607b

File tree

1 file changed

+1
-1
lines changed
  • crates/oxc_formatter/src/formatter/format_element

1 file changed

+1
-1
lines changed

crates/oxc_formatter/src/formatter/format_element/document.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Document<'_> {
119119
false
120120
}
121121
// `FormatElement::Token` cannot contain line breaks
122-
FormatElement::Text { text, .. } => text.contains('\n'),
122+
FormatElement::Text { text, width } => width.is_multiline(),
123123
FormatElement::ExpandParent
124124
| FormatElement::Line(LineMode::Hard | LineMode::Empty) => true,
125125
_ => false,

0 commit comments

Comments
 (0)