Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e401ca

Browse filesBrowse files
committed
update string template rule and test
1 parent d9bc436 commit 4e401ca
Copy full SHA for 4e401ca

2 files changed

+5-6Lines changed: 5 additions & 6 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/formatting/rules.ts‎

Copy file name to clipboardExpand all lines: src/services/formatting/rules.ts
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +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),
131-
132-
// No space between closing parenthesis and template string
133-
rule("NoSpaceBetweenCloseParenAndTemplateString", SyntaxKind.CloseParenToken, SyntaxKind.NoSubstitutionTemplateLiteral, [isNonJsxSameLineTokenContext], RuleAction.Delete),
129+
// Template string
130+
rule("NoSpaceBetweenTagAndTemplateString", [SyntaxKind.Identifier, SyntaxKind.CloseParenToken], [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete),
134131

135132
// JSX opening elements
136133
rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space),
Collapse file

‎tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts‎

Copy file name to clipboardExpand all lines: tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
//// foo() `abc`;
44
//// bar()`def`;
5+
//// baz()`a${x}b`;
56

67
format.document();
78
verify.currentFileContentIs(
89
`foo()\`abc\`;
9-
bar()\`def\`;`
10+
bar()\`def\`;
11+
baz()\`a\${x}b\`;`
1012
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.