-
Notifications
You must be signed in to change notification settings - Fork 54
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: Add Support for single space trailing comments #219
Comments
% |
In Emacs erlang-mode (the standard indentation within OTP), trailing comment are placed on column 48. See https://erlang.org/doc/man/erlang.el.html#indent In Emacs, you can press Alt+; to create a trailing comment. |
Yes, we did an analyses and found this is not as popular as we had hoped :( |
Thanks for the reply! I agree, it's not very commonly seen. I just wasn't sure if you were aware of this at all. |
It would be interesting to format all of the OTP code with erlfmt and I am investigating when, how and if we should do that.
|
Ecstatic to hear that you are considering formatting OTP with
We believe this work is backwards compatible: would not result in already formatted files changing, that is why it is not included in milestone 1.0.0 yet. |
After analyses we have decided that support for trailing comments would be a good idea https://github.com/WhatsApp/erlfmt/blob/master/doc/FormattingDecisionComments.md
This does not include aligning comments, only trailing comments with a single space between the code and the comment.
This does however require a significant amount of work to add this support.
There are no promises on when/if this will be delivered.
We do however believe this will be a big improvement to the project.
Concerns include that this will require a lot of decisions to be make about design of layouts.
For example, when an expression ends in a comment that is too long to fit on one line, the
fits
function will see this line as breaking and it will break thatgroup
. Do you keep the comment on the same line as the lastgroup
or do you have abreak
between it and the lastgroup
resulting in it being formatted below the expression. This is just one of the tough decisions that will need to be made on this implementation journey.Reworking the algorithm to move the comment to the line above, only in the case that it breaks would require inventing a new operator for the fitting algorithm. If we do this, we could probably write a paper for ICFP.
The text was updated successfully, but these errors were encountered: