From 1bf9b25ce46189cb63a71d76d96b69faed322ef1 Mon Sep 17 00:00:00 2001 From: Nicholas Yang Date: Thu, 14 Apr 2022 17:08:18 -0400 Subject: [PATCH] feature: Starting spread attribute --- .../src/jsx/attribute/spread_attribute.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs b/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs index 2a71b32666f..888e3c02e3b 100644 --- a/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs +++ b/crates/rome_js_formatter/src/jsx/attribute/spread_attribute.rs @@ -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 { - 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)?, + ]) } }