-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Fixes some formatting for decorators #2664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
|
|
||
| /////*1*/ @ decorator1 | ||
| /////*2*/ @ decorator2 | ||
| /////*3*/ @decorator3 | ||
| /////*4*/ @ decorator4 @ decorator5 | ||
| /////*5*/class C { | ||
| /////*6*/ @ decorator6 | ||
| /////*7*/ @ decorator7 | ||
| /////*8*/ @decorator8 | ||
| /////*9*/ method1() { } | ||
| //// | ||
| /////*10*/ @ decorator9 @ decorator10 @decorator11 method2() { } | ||
| //// | ||
| //// method3( | ||
| /////*11*/ @ decorator12 | ||
| /////*12*/ @ decorator13 | ||
| /////*13*/ @decorator14 | ||
| /////*14*/ x) { } | ||
| //// | ||
| //// method4( | ||
| /////*15*/ @ decorator15 @ decorator16 @decorator17 x) { } | ||
| //// | ||
| /////*16*/ @ decorator18 | ||
| /////*17*/ @ decorator19 | ||
| /////*18*/ @decorator20 | ||
| /////*19*/ ["computed1"]() { } | ||
| //// | ||
| /////*20*/ @ decorator21 @ decorator22 @decorator23 ["computed2"]() { } | ||
| //// | ||
| /////*21*/ @ decorator24 | ||
| /////*22*/ @ decorator25 | ||
| /////*23*/ @decorator26 | ||
| /////*24*/ get accessor1() { } | ||
| //// | ||
| /////*25*/ @ decorator27 @ decorator28 @decorator29 get accessor2() { } | ||
| //// | ||
| /////*26*/ @ decorator30 | ||
| /////*27*/ @ decorator31 | ||
| /////*28*/ @decorator32 | ||
| /////*29*/ property1; | ||
| //// | ||
| /////*30*/ @ decorator33 @ decorator34 @decorator35 property2; | ||
| ////} | ||
|
|
||
| format.document(); | ||
| goTo.marker("1"); | ||
| verify.currentLineContentIs("@decorator1"); | ||
| goTo.marker("2"); | ||
| verify.currentLineContentIs("@decorator2"); | ||
| goTo.marker("3"); | ||
| verify.currentLineContentIs("@decorator3"); | ||
| goTo.marker("4"); | ||
| verify.currentLineContentIs("@decorator4 @decorator5"); | ||
| goTo.marker("5"); | ||
| verify.currentLineContentIs("class C {"); | ||
| goTo.marker("6"); | ||
| verify.currentLineContentIs(" @decorator6"); | ||
| goTo.marker("7"); | ||
| verify.currentLineContentIs(" @decorator7"); | ||
| goTo.marker("8"); | ||
| verify.currentLineContentIs(" @decorator8"); | ||
| goTo.marker("9"); | ||
| verify.currentLineContentIs(" method1() { }"); | ||
| goTo.marker("10"); | ||
| verify.currentLineContentIs(" @decorator9 @decorator10 @decorator11 method2() { }"); | ||
| goTo.marker("11"); | ||
| verify.currentLineContentIs(" @decorator12"); | ||
| goTo.marker("12"); | ||
| verify.currentLineContentIs(" @decorator13"); | ||
| goTo.marker("13"); | ||
| verify.currentLineContentIs(" @decorator14"); | ||
| goTo.marker("14"); | ||
| verify.currentLineContentIs(" x) { }"); | ||
| goTo.marker("15"); | ||
| verify.currentLineContentIs(" @decorator15 @decorator16 @decorator17 x) { }"); | ||
| goTo.marker("16"); | ||
| verify.currentLineContentIs(" @decorator18"); | ||
| goTo.marker("17"); | ||
| verify.currentLineContentIs(" @decorator19"); | ||
| goTo.marker("18"); | ||
| verify.currentLineContentIs(" @decorator20"); | ||
| goTo.marker("19"); | ||
| verify.currentLineContentIs(" [\"computed1\"]() { }"); | ||
| goTo.marker("20"); | ||
| verify.currentLineContentIs(" @decorator21 @decorator22 @decorator23 [\"computed2\"]() { }"); | ||
| goTo.marker("21"); | ||
| verify.currentLineContentIs(" @decorator24"); | ||
| goTo.marker("22"); | ||
| verify.currentLineContentIs(" @decorator25"); | ||
| goTo.marker("23"); | ||
| verify.currentLineContentIs(" @decorator26"); | ||
| goTo.marker("24"); | ||
| verify.currentLineContentIs(" get accessor1() { }"); | ||
| goTo.marker("25"); | ||
| verify.currentLineContentIs(" @decorator27 @decorator28 @decorator29 get accessor2() { }"); | ||
| goTo.marker("26"); | ||
| verify.currentLineContentIs(" @decorator30"); | ||
| goTo.marker("27"); | ||
| verify.currentLineContentIs(" @decorator31"); | ||
| goTo.marker("28"); | ||
| verify.currentLineContentIs(" @decorator32"); | ||
| goTo.marker("29"); | ||
| verify.currentLineContentIs(" property1;"); | ||
| goTo.marker("30"); | ||
| verify.currentLineContentIs(" @decorator33 @decorator34 @decorator35 property2;"); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for space after decorator should not be added
or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would add "function" as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhegazy, can you clarify what you mean by this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhegazy, I'm not sure what you're trying illustrate with this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i meant functionKeyword.
@dec function func() {}thought we can add that when we support itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i meant the sapceAfterDecorator rule would not apply to decorators expressions.