diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 36ea7de23b4..6f15135982b 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -129,6 +129,9 @@ namespace ts.formatting { // template string rule("NoSpaceBetweenTagAndTemplateString", SyntaxKind.Identifier, [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete), + // No space between closing parenthesis and template string + rule("NoSpaceBetweenCloseParenAndTemplateString", SyntaxKind.CloseParenToken, SyntaxKind.NoSubstitutionTemplateLiteral, [isNonJsxSameLineTokenContext], RuleAction.Delete), + // JSX opening elements rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space), rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, SyntaxKind.SlashToken, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], RuleAction.Space), diff --git a/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts b/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts new file mode 100644 index 00000000000..47de1fac5d6 --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts @@ -0,0 +1,10 @@ +/// + +//// foo() `abc`; +//// bar()`def`; + +format.document(); +verify.currentFileContentIs( +`foo()\`abc\`; +bar()\`def\`;` +);