Skip to content

Commit

Permalink
fix #20449, insert space between decorators (#20491)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme authored and mhegazy committed Jan 5, 2018
1 parent 7ef541c commit 67eabb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/services/formatting/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ namespace ts.formatting {
RuleAction.Delete),

// decorators
rule("SpaceBeforeAt", anyToken, SyntaxKind.AtToken, [isNonJsxSameLineTokenContext], RuleAction.Space),
rule("SpaceBeforeAt", [SyntaxKind.CloseParenToken, SyntaxKind.Identifier], SyntaxKind.AtToken, [isNonJsxSameLineTokenContext], RuleAction.Space),
rule("NoSpaceAfterAt", SyntaxKind.AtToken, anyToken, [isNonJsxSameLineTokenContext], RuleAction.Delete),
// Insert space after @ in decorator
rule("SpaceAfterDecorator",
Expand Down
8 changes: 7 additions & 1 deletion tests/cases/fourslash/formattingDecorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
/////*29*/ property1;
////
/////*30*/ @ decorator33 @ decorator34 @decorator35 property2;
/////*31*/function test(@decorator36@decorator37 param) {};
/////*32*/function test2(@decorator38()@decorator39()param) {};
////}

format.document();
Expand Down Expand Up @@ -103,4 +105,8 @@ verify.currentLineContentIs(" @decorator32");
goTo.marker("29");
verify.currentLineContentIs(" property1;");
goTo.marker("30");
verify.currentLineContentIs(" @decorator33 @decorator34 @decorator35 property2;");
verify.currentLineContentIs(" @decorator33 @decorator34 @decorator35 property2;");
goTo.marker("31");
verify.currentLineContentIs("function test(@decorator36 @decorator37 param) { };");
goTo.marker("32");
verify.currentLineContentIs("function test2(@decorator38() @decorator39() param) { };");

0 comments on commit 67eabb9

Please sign in to comment.