Skip to content

Semi-preserve invalid Haddock comments#803

Merged
mrkkrp merged 1 commit intomasterfrom
amesgen/issue-474
Oct 14, 2021
Merged

Semi-preserve invalid Haddock comments#803
mrkkrp merged 1 commit intomasterfrom
amesgen/issue-474

Conversation

@amesgen
Copy link
Copy Markdown
Contributor

@amesgen amesgen commented Oct 14, 2021

Closes #474

Overview:

  • comment_q and annotation_comments contain all comments, i.e. regular Haddock comments (which are also present in the AST via HsDocString), invalid Haddock comments (which are not present in the AST) and regular, non-Haddock comments.
  • We now print the invalid Haddock comments as regular comments, where we have to be careful:
    • Multiline invalid Haddock comments are not parsed as multiple single-line comments (in contrast to regular comments). This requires some changes in mkComment and AST diffing.
    • We have to insert a space after the hyphens if the comment does not start with a space to prevent a weird issue (see invalid-haddock-weird.hs).

Copy link
Copy Markdown
Member

@mrkkrp mrkkrp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Invalid Haddock comments are no longer silently deleted, but rather
converted into regular comments.
@mrkkrp mrkkrp force-pushed the amesgen/issue-474 branch from 073b0ea to 453257c Compare October 14, 2021 18:08
@mrkkrp mrkkrp merged commit ca9ae9d into master Oct 14, 2021
@mrkkrp mrkkrp deleted the amesgen/issue-474 branch October 14, 2021 18:14
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 this pull request may close these issues.

Ormolu completely deletes misplaced Haddock comments

2 participants