feat(prettier): basic TaggedTemplateExpression printing (#1486)

This commit is contained in:
Shannon Rothe 2023-11-22 01:15:29 +11:00 committed by GitHub
parent 4fb4a85ab1
commit 8934ddb590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -916,6 +916,12 @@ impl<'a> Format<'a> for TSTypeParameterDeclaration<'a> {
}
}
impl<'a> Format<'a> for TSTypeParameterInstantiation<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
}
}
impl<'a> Format<'a> for TSTupleElement<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
@ -1732,7 +1738,19 @@ impl<'a> Format<'a> for TemplateElement {
impl<'a> Format<'a> for TaggedTemplateExpression<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
Doc::Line
let mut parts = p.vec();
parts.push(format!(p, self.tag));
if let Some(type_parameters) = &self.type_parameters {
parts.push(string!(p, "<"));
parts.push(format!(p, type_parameters));
parts.push(string!(p, ">"));
}
parts.push(format!(p, self.quasi));
Doc::Array(parts)
}
}