Auto format: no space between closing parenthesis and string template

This commit is contained in:
Ken703
2018-04-25 21:10:35 -04:00
parent f7a0e0cb42
commit d9bc436788
2 changed files with 13 additions and 0 deletions
+3
View File
@@ -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),
@@ -0,0 +1,10 @@
/// <reference path="fourslash.ts"/>
//// foo() `abc`;
//// bar()`def`;
format.document();
verify.currentFileContentIs(
`foo()\`abc\`;
bar()\`def\`;`
);