Merge pull request #23697 from Ken703/bug/23047

Formatting: fix unwanted space between closing parenthesis and string template
This commit is contained in:
Mohamed Hegazy 2018-04-30 10:19:17 -07:00 committed by GitHub
commit 8793b8c56b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -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),

View file

@ -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\`;`
);