Converting multiline haddock module description with markup creates parse error
Is your feature request specific to Fourmolu?
- [x] Yes, this feature is not relevant to Ormolu
Describe the current + desired formatting
{-|
This example
@
test
@
-}
Gets translated to
-- |
--This example
--@
-- test
--@
Which will result in a parse error on --@
I'd recommend it translate to
-- |
-- This example
-- @
-- test
-- @
Thanks for the report! @georgefst, curious what your thoughts are on this. On one hand, it's been bothering me for a while that
-- | a
-- multiline
-- comment
gets converted into
{- | a
multiline
comment
-}
with leading spaces, since with single line -- comment style, I don't think of the leading space as part of the comment, but as part of the syntax. But I also get that the GHC parser parses the space as part of the comment content, and we probably don't want to modify what GHC parsed.
On one hand, it's been bothering me for a while that
Yeah, it annoys me too. I think we can and should fix it.
But I also get that the GHC parser parses the space as part of the comment content, and we probably don't want to modify what GHC parsed.
I'm pretty sure we already have some sort of ignoreASTChange function somewhere (inherited from Ormolu) for special cases where we know we're technically changing the AST, but nobody's likely to care.
As for this issue, I think inserting a leading space on all lines (when there isn't one already) would be totally reasonable. Especially since #120.