Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) { };");