mirror of
https://github.com/ilyakooo0/ormolu.git
synced 2024-09-17 19:57:56 +03:00
Fix the bug when comments in different styles get glued together
This commit is contained in:
parent
c97ba55762
commit
e29dd2b1c7
@ -1,3 +1,8 @@
|
|||||||
|
## Ormolu 0.1.2.0
|
||||||
|
|
||||||
|
* Fixed the bug when comments in different styles got glued together after
|
||||||
|
formatting. [Issue 589](https://github.com/tweag/ormolu/issues/589).
|
||||||
|
|
||||||
## Ormolu 0.1.1.0
|
## Ormolu 0.1.1.0
|
||||||
|
|
||||||
* Imports in a import lists are now normalized: duplicate imports are
|
* Imports in a import lists are now normalized: duplicate imports are
|
||||||
|
7
data/examples/other/comment-glued-together-out.hs
Normal file
7
data/examples/other/comment-glued-together-out.hs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module Main (main) where
|
||||||
|
|
||||||
|
-- | Foo.
|
||||||
|
|
||||||
|
-- Bar
|
||||||
|
main :: IO ()
|
||||||
|
main = return ()
|
6
data/examples/other/comment-glued-together.hs
Normal file
6
data/examples/other/comment-glued-together.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module Main (main) where
|
||||||
|
|
||||||
|
{- | Foo. -}
|
||||||
|
-- Bar
|
||||||
|
main :: IO ()
|
||||||
|
main = return ()
|
@ -2,10 +2,6 @@ The GHC parser (in Haddock mode) failed:
|
|||||||
src/Idris/Parser.hs:1052:1
|
src/Idris/Parser.hs:1052:1
|
||||||
parse error on input `@'
|
parse error on input `@'
|
||||||
|
|
||||||
AST of input and AST of formatted code differ.
|
|
||||||
at src/Idris/Parser/Data.hs:281:1-29
|
|
||||||
Please, consider reporting the bug.
|
|
||||||
|
|
||||||
The GHC parser (in Haddock mode) failed:
|
The GHC parser (in Haddock mode) failed:
|
||||||
src/Idris/Parser/Expr.hs:75:1
|
src/Idris/Parser/Expr.hs:75:1
|
||||||
parse error on input `@'
|
parse error on input `@'
|
||||||
|
@ -154,6 +154,7 @@ needsNewlineBefore ::
|
|||||||
-- | Last printed comment span
|
-- | Last printed comment span
|
||||||
Maybe SpanMark ->
|
Maybe SpanMark ->
|
||||||
Bool
|
Bool
|
||||||
|
needsNewlineBefore _ (Just (HaddockSpan _ _)) = True
|
||||||
needsNewlineBefore l mlastMark =
|
needsNewlineBefore l mlastMark =
|
||||||
case spanMarkSpan <$> mlastMark of
|
case spanMarkSpan <$> mlastMark of
|
||||||
Nothing -> False
|
Nothing -> False
|
||||||
@ -238,8 +239,7 @@ commentFollowsElt ref mnSpn meSpn mlastMark (L l comment) =
|
|||||||
-- lexemes in front of it and goes right after the previous comment.
|
-- lexemes in front of it and goes right after the previous comment.
|
||||||
not (hasAtomsBefore comment)
|
not (hasAtomsBefore comment)
|
||||||
&& ( case mlastMark of
|
&& ( case mlastMark of
|
||||||
Just (HaddockSpan _ spn) ->
|
Just (HaddockSpan _ _) -> False
|
||||||
srcSpanEndLine spn + 1 == srcSpanStartLine l
|
|
||||||
Just (CommentSpan spn) ->
|
Just (CommentSpan spn) ->
|
||||||
srcSpanEndLine spn + 1 == srcSpanStartLine l
|
srcSpanEndLine spn + 1 == srcSpanStartLine l
|
||||||
_ -> False
|
_ -> False
|
||||||
|
Loading…
Reference in New Issue
Block a user