AdRoll / rebar3_format

Erlang Formatter for Rebar3
https://tech.nextroll.com/blog/dev/2020/02/25/erlang-rebar3-format.html
MIT License
108 stars 21 forks source link

Extra line after a type and before a comment prevents edoc from parsing it correctly #356

Open elbrujohalcon opened 9 months ago

elbrujohalcon commented 9 months ago

Describe the bug The default formatter adds an empty line after an attribute if it finds a comment below it. That's an issue because EDoc uses comments after -types to document those types and it does not work if there is an empty line between one thing and the other. For a more detailed explanation, check @erszcz's amazing comment here: https://github.com/inaka/worker_pool/pull/200#discussion_r1432579910

To Reproduce Try to format a module containing this:

-opaque another_list(X) :: [X].
%% another_list() is a kind of list...

The formatter turns it into…

-opaque another_list(X) :: [X].

%% another_list() is a kind of list...

Expected behavior The text should remain as is.