-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
Related to #63
This PR solves the above issue by fixing a bug in detecting whether a comment is indented or not. When this bug is fixed, fourmolu will always use single line comments for indented haddocks, e.g.
class Foo a where
-- | asdf
-- asdf
foo :: a
{-| asdf
asdf
-}
bar :: IntIt would be nice if these haddocks could use the same style as non-indented functions, e.g.
class Foo a where
{-| asdf
asdf
-}
foo :: a
{-| asdf
asdf
-}
bar :: IntThis seems to mostly be a one-line change:
getPrinterOpt poHaddockStyle >>= \case
HaddockSingleLine -> pure True
- -- Use multiple single-line comments when the whole comment is indented
- HaddockMultiLine -> maybe False ((> 1) . srcSpanStartCol) <$> getSrcSpan l
+ HaddockMultiLine -> pure Falsebut this fails when checking if the AST is the same as before, because of whitespace differences in the comment, e.g.
-- from
HsDocString " A multiline\n comment here"
-- to
HsDocString " A multiline\n comment here\n "One possible solution is to also trim leading whitespace when doing the AST check (but not when printing out the haddock in p_hsDocString)
Metadata
Metadata
Assignees
Labels
No labels