Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions crates/oxc_formatter/src/utils/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@ impl PartialEq for JsxChild<'_, '_> {

impl Eq for JsxChild<'_, '_> {}

impl JsxChild<'_, '_> {
pub const fn is_any_line(&self) -> bool {
matches!(self, Self::EmptyLine | Self::Newline)
}
}

/// A word in a Jsx Text. A word is string sequence that isn't separated by any JSX whitespace.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct JsxWord<'a> {
Expand Down
13 changes: 1 addition & 12 deletions crates/oxc_formatter/src/write/jsx/child_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,10 @@ impl FormatJsxChildList {
JsxChild::Whitespace => {
flat.write(&JsxSpace, f);

// ```javascript
// <div>a
// {' '}</div>
// ```
let is_after_line_break = last.as_ref().is_some_and(|last| last.is_any_line());

// `<div>aaa </div>` or `<div> </div>`
let is_trailing_or_only_whitespace = children_iter.peek().is_none();

if is_trailing_or_only_whitespace || is_after_line_break {
if is_trailing_or_only_whitespace {
multiline.write_separator_in_last_entry(&JsxRawSpace, f);
}
// Leading whitespace. Only possible if used together with a expression child
Expand Down Expand Up @@ -587,12 +581,7 @@ impl<'a> MultilineBuilder<'a> {
}
}
MultilineLayout::NoFill => {
// TODO: separator
write!(buffer, [content, separator]);

if let Some(separator) = separator {
write!(buffer, [separator]);
}
}
}
buffer.into_vec()
Expand Down
Loading