Skip to content

Commit d9bc436

Browse files
committed
Auto format: no space between closing parenthesis and string template
1 parent f7a0e0c commit d9bc436

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/services/formatting/rules.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ namespace ts.formatting {
129129
// template string
130130
rule("NoSpaceBetweenTagAndTemplateString", SyntaxKind.Identifier, [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
131131

132+
// No space between closing parenthesis and template string
133+
rule("NoSpaceBetweenCloseParenAndTemplateString", SyntaxKind.CloseParenToken, SyntaxKind.NoSubstitutionTemplateLiteral, [isNonJsxSameLineTokenContext], RuleAction.Delete),
134+
132135
// JSX opening elements
133136
rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space),
134137
rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, SyntaxKind.SlashToken, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], RuleAction.Space),
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// foo() `abc`;
4+
//// bar()`def`;
5+
6+
format.document();
7+
verify.currentFileContentIs(
8+
`foo()\`abc\`;
9+
bar()\`def\`;`
10+
);

0 commit comments

Comments
 (0)