-
Notifications
You must be signed in to change notification settings - Fork 28
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
Comments in else if
are formatted *really* poorly
#1470
Comments
Ignoring the specific challenge of implementing this, I would strongly advise (in fact I'll probably add it to the lint rules) that comments don't split While the runtime sees |
hmmm :/ that said I suppose putting the comments above would also look bad if the formatter does what I think it would do
not sure, need to test it |
Definitely agree with that, but if they've already put a comment in between there, and especially given the line-breaking required, it seems like they aren't considering it an If the formatter is indeed able to distinguish them move only intervening comments to the previous line, with the proper indentation, then I definitely agree that's the best formatting (and is how I fixed this example in the actual code), but then we have the question of
|
Don't nest elses like that, treat "else if" as a keyword. If you have a larger block then the formatting won't work break when you do that. |
If I remember the sequence of events here, the Whether it's a good idea or not, it is technically possible to add a comment between an |
gets formatted as
I'm not only surprised that having the second
if
at the same indentation as the firstelse
works (or, at least, the LSP doesn't complain), there's actually a trailing space added after the firstelse
. This should probably just formatted identically to how it originally was (indented and no trailing space).The text was updated successfully, but these errors were encountered: