This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicholas Yang
committed
Apr 11, 2022
1 parent
d807e61
commit 71490d7
Showing
5 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
use crate::formatter_traits::FormatTokenAndNode; | ||
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement}; | ||
use rome_js_syntax::{AstNode, JsxName}; | ||
use rome_js_syntax::JsxName; | ||
|
||
impl ToFormatElement for JsxName { | ||
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> { | ||
Ok(formatter.format_verbatim(self.syntax())) | ||
self.value_token().format(formatter) | ||
} | ||
} |
17 changes: 15 additions & 2 deletions
17
crates/rome_js_formatter/src/jsx/auxiliary/namespace_name.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
use crate::formatter_traits::FormatTokenAndNode; | ||
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement}; | ||
use rome_js_syntax::{AstNode, JsxNamespaceName}; | ||
use rome_formatter::format_elements; | ||
use rome_js_syntax::{JsxNamespaceName, JsxNamespaceNameFields}; | ||
|
||
impl ToFormatElement for JsxNamespaceName { | ||
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> { | ||
Ok(formatter.format_verbatim(self.syntax())) | ||
let JsxNamespaceNameFields { | ||
namespace, | ||
colon_token, | ||
name, | ||
} = self.as_fields(); | ||
|
||
Ok(format_elements![ | ||
namespace.format(formatter)?, | ||
colon_token.format(formatter)?, | ||
name.format(formatter)? | ||
]) | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
crates/rome_js_formatter/src/jsx/auxiliary/reference_identifier.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
use crate::formatter_traits::FormatTokenAndNode; | ||
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement}; | ||
use rome_js_syntax::{AstNode, JsxReferenceIdentifier}; | ||
use rome_js_syntax::JsxReferenceIdentifier; | ||
|
||
impl ToFormatElement for JsxReferenceIdentifier { | ||
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> { | ||
Ok(formatter.format_verbatim(self.syntax())) | ||
self.value_token().format(formatter) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
use crate::formatter_traits::FormatTokenAndNode; | ||
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement}; | ||
use rome_js_syntax::{AstNode, JsxMemberName}; | ||
use rome_formatter::format_elements; | ||
use rome_js_syntax::{JsxMemberName, JsxMemberNameFields}; | ||
|
||
impl ToFormatElement for JsxMemberName { | ||
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> { | ||
Ok(formatter.format_verbatim(self.syntax())) | ||
let JsxMemberNameFields { | ||
object, | ||
dot_token, | ||
member, | ||
} = self.as_fields(); | ||
|
||
Ok(format_elements![ | ||
object.format(formatter)?, | ||
dot_token.format(formatter)?, | ||
member.format(formatter)?, | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters