Skip to content

Comments: Add Support for single space trailing comments #219

@awalterschulze

Description

@awalterschulze

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

a, % trailing comment

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 that group. Do you keep the comment on the same line as the last group or do you have a break between it and the last group 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions