fix: stable format for if/for/while/do/catch/switch with trailing comment#595
fix: stable format for if/for/while/do/catch/switch with trailing comment#595jtkiesel wants to merge 1 commit intojhipster:mainfrom
Conversation
01ee02b to
4a36754
Compare
| } | ||
|
|
||
| ifStatement(ctx: IfStatementCtx) { | ||
| handleCommentsIfStatement(ctx); |
There was a problem hiding this comment.
Is this issue only happening on if statements ?
There was a problem hiding this comment.
Looks like it also happens with for/while/do loops and switch/catch statements. I'll see about fixing those cases as well.
There was a problem hiding this comment.
Latest push now handles for/while/do loops and switch/catch statements as well.
4a36754 to
020b09e
Compare
|
Thank you, @jtkiesel ! It seems that quite a lot of logic is added in order to handle this edge case. I would like to dig a bit more into the issue to see if we can simplify some things before merging this. My objective would be to look at it by the end of the week (and the other pending PR) so we could release a new version of Prettier this weekend :) |
020b09e to
a356f53
Compare
|
I looked at it more closely yesterday, but was not able to wrap it up, sorry. I propose to make a new release with the changes that were made since 2.2.0 (#600), and finish this afterwards. |
|
Sounds good! I'll try to take another look at it this week as well, and see if I can simplify it at all. |
|
@clementdessoude @jtkiesel Did you find time to look into this? 😇 |
|
Superseded by #731. |
What changed with this PR:
If/for/while/do/catch/switch statements whose parentheses have trailing comments are now formatted stably, and in general are formatted more closely to the way that Prettier JavaScript does.
Example
Input
Output
Relative issues or prs:
Closes #592