Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
feature: Starting spread attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Yang committed Apr 14, 2022
1 parent 03c946e commit 1bf9b25
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
use crate::formatter_traits::FormatTokenAndNode;
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement};
use rome_js_syntax::JsxSpreadAttribute;
use rome_rowan::AstNode;
use rome_formatter::format_elements;
use rome_js_syntax::{JsxSpreadAttribute, JsxSpreadAttributeFields};

impl ToFormatElement for JsxSpreadAttribute {
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> {
Ok(formatter.format_verbatim(self.syntax()))
let JsxSpreadAttributeFields {
l_curly_token,
dotdotdot_token,
argument,
r_curly_token,
} = self.as_fields();

Ok(format_elements![
l_curly_token.format(formatter)?,
dotdotdot_token.format(formatter)?,
argument.format(formatter)?,
r_curly_token.format(formatter)?,
])
}
}

0 comments on commit 1bf9b25

Please sign in to comment.