Skip to content

Commit 8793b8c

Browse files
authored
Merge pull request #23697 from Ken703/bug/23047
Formatting: fix unwanted space between closing parenthesis and string template
2 parents 33d20e9 + 4e401ca commit 8793b8c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/services/formatting/rules.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ namespace ts.formatting {
126126
rule("SpaceBetweenAsyncAndOpenParen", SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken, [isArrowFunctionContext, isNonJsxSameLineTokenContext], RuleAction.Space),
127127
rule("SpaceBetweenAsyncAndFunctionKeyword", SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword, [isNonJsxSameLineTokenContext], RuleAction.Space),
128128

129-
// template string
130-
rule("NoSpaceBetweenTagAndTemplateString", SyntaxKind.Identifier, [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
129+
// Template string
130+
rule("NoSpaceBetweenTagAndTemplateString", [SyntaxKind.Identifier, SyntaxKind.CloseParenToken], [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
131131

132132
// JSX opening elements
133133
rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// foo() `abc`;
4+
//// bar()`def`;
5+
//// baz()`a${x}b`;
6+
7+
format.document();
8+
verify.currentFileContentIs(
9+
`foo()\`abc\`;
10+
bar()\`def\`;
11+
baz()\`a\${x}b\`;`
12+
);

0 commit comments

Comments
 (0)