Skip to content
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

format of code with comments specified in ex_doc #109

Closed
7run opened this issue Sep 25, 2024 · 4 comments · Fixed by #110
Closed

format of code with comments specified in ex_doc #109

7run opened this issue Sep 25, 2024 · 4 comments · Fixed by #110

Comments

@7run
Copy link

7run commented Sep 25, 2024

this is about the format when writing comments using the method specified by ex_doc, which is available from OTP27.

when the following code is formatted, it is expected to appear as shown in the link below

-module(math).
-moduledoc """
A module for basic arithmetic.
""".

-export([add/2]).

-doc "Adds two numbers together.".
-spec add(number(), number()) -> number().
add(One, Two) ->
    One + Two.

https://erlang.org/documentation/doc-15.0-rc1/doc/system/documentation.html

However, in reality, two blank lines are inserted between the function and the comment, as shown below:

-module(math).
-moduledoc """
A module for basic arithmetic.
""".

-export([add/2]).

-doc "Adds two numbers together.".


-spec add(number(), number()) -> number().
add(One, Two) ->
    One + Two.

If there is any workaround, I would appreciate your advice.

@sile
Copy link
Owner

sile commented Sep 25, 2024

Thank you for reporting this issue.
I think that efmt should be fixed to handle this case correctly.

@sile
Copy link
Owner

sile commented Sep 25, 2024

[FYI] Just released efmt-v0.18.3, which includes a fix for this issue.

@7run
Copy link
Author

7run commented Sep 27, 2024

Thank you very much.
I was able to use the corrected version successfully and the problem has been resolved.

@sile
Copy link
Owner

sile commented Sep 27, 2024

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants