fix #20449, insert space between decorators (#20491)

This commit is contained in:
Herrington Darkholme 2018-01-05 08:57:27 +08:00 committed by Mohamed Hegazy
parent 7ef541ca1f
commit 67eabb98bc
2 changed files with 8 additions and 2 deletions

View file

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

View file

@ -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();
@ -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) { };");