Merge pull request #23697 from Ken703/bug/23047
Formatting: fix unwanted space between closing parenthesis and string template
This commit is contained in:
commit
8793b8c56b
2 changed files with 14 additions and 2 deletions
|
@ -126,8 +126,8 @@ namespace ts.formatting {
|
|||
rule("SpaceBetweenAsyncAndOpenParen", SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken, [isArrowFunctionContext, isNonJsxSameLineTokenContext], RuleAction.Space),
|
||||
rule("SpaceBetweenAsyncAndFunctionKeyword", SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword, [isNonJsxSameLineTokenContext], RuleAction.Space),
|
||||
|
||||
// template string
|
||||
rule("NoSpaceBetweenTagAndTemplateString", SyntaxKind.Identifier, [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
|
||||
// Template string
|
||||
rule("NoSpaceBetweenTagAndTemplateString", [SyntaxKind.Identifier, SyntaxKind.CloseParenToken], [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
|
||||
|
||||
// JSX opening elements
|
||||
rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space),
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
//// foo() `abc`;
|
||||
//// bar()`def`;
|
||||
//// baz()`a${x}b`;
|
||||
|
||||
format.document();
|
||||
verify.currentFileContentIs(
|
||||
`foo()\`abc\`;
|
||||
bar()\`def\`;
|
||||
baz()\`a\${x}b\`;`
|
||||
);
|
Loading…
Reference in a new issue