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

Avoid changing definition docs into module docs #771

Open
avh4 opened this issue Sep 13, 2022 · 1 comment
Open

Avoid changing definition docs into module docs #771

avh4 opened this issue Sep 13, 2022 · 1 comment

Comments

@avh4
Copy link
Owner

avh4 commented Sep 13, 2022

Example input:

module Foo exposing (..)

{-| returns 5 -}
foo = 5

Current output:

module Foo exposing (..)

{-| returns 5 -}


foo = 5

The reason this was done is because elm make will use the comment as a module documentation. But this is annoying to people who just want the comment to stay with the definition. I hear confusion about this every year or two.

Proposal: A better solution would be to insert an empty module doc, so output would be:

module Foo exposing (..)

{-| -}


{-| returns 5 -}
foo = 5

The trigger for this should probably be whether or not the doc comment is on the line immediately above the definition. The comment should be read as the module docs if there is more space between them.

@lydell
Copy link
Contributor

lydell commented Sep 13, 2022

That might lead to people reporting a “bug” where an extra {-| -} appears out of the blue. So maybe we have to do this:

module Foo exposing (..)

{-| Module documentation comment inserted by elm-format to avoid an `elm make` bug – see https://somewhere -}


{-| returns 5 -}
foo = 5

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

No branches or pull requests

2 participants