-
Notifications
You must be signed in to change notification settings - Fork 73
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
Unwanted line wrap in if/else conditions without curly brackets #869
Comments
Oh I've figured that by removing |
I see, thanks for reporting this. Fixing this kind of comment-related stuff tends to be a PITA, but I agree it's not ideal. For the record, prettier-js does what you expect (so we should aim for the same behavior): function f() {
// Comment 1
if (x > 0) x--;
// Comment 2
else {
x++;
}
} |
@fvictorio Yeah indeed I'm used to use this syntax too in JS/TS, thanks for checking. |
Hi, Sorry for the late reply. This is not an new idea for me. I've actually attempted twice over the years implementing all the cases for Will give it yet another go at these cases and see if the third time is the charmed. |
Hi ! Firstly, thanks for this amazing plugin.
Then, a thing I visually love is to write inline if/else conditions when their content is composed by a single simple line, e.g.,
This plugin seems to allow this except if the
if
statement is followed by anelse if
orelse
statement that uses curly brackets. So the above example will work but this one will receive a line wrap :As you can see the
else
comment is not anymore aligned with theelse
statement, and the if statement is not inline anymore.However, if the
if
line doesn't exceed the Prettier'sprintWidth
, the expected result would be:The text was updated successfully, but these errors were encountered: