-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Improve haddock comments #3207
Improve haddock comments #3207
Conversation
9a67492
to
2f425ae
Compare
…haskell-language-server into kokobd/improve-haddock-comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, the new code is very nicely commented and structured. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and sensible. It seems like we go to some lengths to recognize Haddock - is this something we could ask upstream to tell us? i.e. identify comments as haddock comments when they are?
#endif | ||
|
||
-- | Determines the given node has haddock comments attached to it. | ||
hasHaddock :: Data a => Anns -> Located a -> Maybe Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this just return False
in the Nothing
case? Or is it useful to be able to distinguish "don't know"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to leave the caller to decide what to do when the given Located a
is missing in the Anns
. For example, the caller use False
as the condition to enable the action for adding new haddock comments, but if it's Nothing
, we should disable this action.
@michaelpj Oh, I actually didn't expect this to be merged so quickly ;) I'll check that in another PR, when handling ghc 9.2 support. |
Changes
Limitations
Motivation
Previously, when you execute the "Generate fields comments" action on the following record:
You will get:
I think this is not satisfactory, and we should preserve the original indentation as much as we can.