Skip to content

Commit

Permalink
Add space after '--' in single-line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Nov 13, 2022
1 parent c550536 commit a9c377b
Show file tree
Hide file tree
Showing 24 changed files with 104 additions and 86 deletions.
1 change: 1 addition & 0 deletions changelog.d/single-line-space.md
@@ -0,0 +1 @@
Don't consider the first space after `--` part of the comment ([#255](https://github.com/fourmolu/fourmolu/pull/255))
18 changes: 9 additions & 9 deletions data/examples/module-header/leading-empty-line-four-out.hs
@@ -1,12 +1,12 @@
{- |
Module : Text.Megaparsec
Copyright : © 2015–2019 Megaparsec contributors
© 2007 Paolo Martini
© 1999–2001 Daan Leijen
License : FreeBSD
{- |
Module : Text.Megaparsec
Copyright : © 2015–2019 Megaparsec contributors
© 2007 Paolo Martini
© 1999–2001 Daan Leijen
License : FreeBSD
Maintainer : Mark Karpov <markkarpov92@gmail.com>
Stability : experimental
Portability : portable
Maintainer : Mark Karpov <markkarpov92@gmail.com>
Stability : experimental
Portability : portable
-}
module Main where
4 changes: 2 additions & 2 deletions data/examples/module-header/named-section-four-out.hs
Expand Up @@ -8,7 +8,7 @@ module Magic (
)
where

{- $explanation
{- $explanation
Here it goes.
Here it goes.
-}
6 changes: 3 additions & 3 deletions data/examples/other/comment-spacing-four-out.hs
@@ -1,7 +1,7 @@
-- |Something.
-- | Something.
foo ::
-- |Foo.
-- | Foo.
Int ->
-- |Bar.
-- | Bar.
IO ()
foo _ = pure () -- comment
6 changes: 3 additions & 3 deletions data/examples/other/comment-spacing-out.hs
@@ -1,7 +1,7 @@
-- |Something.
-- | Something.
foo ::
-- |Foo.
-- | Foo.
Int ->
-- |Bar.
-- | Bar.
IO ()
foo _ = pure () -- comment
4 changes: 2 additions & 2 deletions data/examples/other/comment-style-transform-four-out.hs
@@ -1,4 +1,4 @@
{- |
{- |
Module: Data.Aeson.TH
Copyright: (c) 2011-2016 Bryan O'Sullivan
(c) 2011 MailRank, Inc.
Expand All @@ -8,7 +8,7 @@ Portability: portable
-}
module Main where

{- |
{- |
Here is a snippet:
Expand Down
20 changes: 10 additions & 10 deletions data/examples/other/comment-style-transform-out.hs
@@ -1,17 +1,17 @@
-- |
--Module: Data.Aeson.TH
--Copyright: (c) 2011-2016 Bryan O'Sullivan
-- (c) 2011 MailRank, Inc.
--License: BSD3
--Stability: experimental
--Portability: portable
-- Module: Data.Aeson.TH
-- Copyright: (c) 2011-2016 Bryan O'Sullivan
-- (c) 2011 MailRank, Inc.
-- License: BSD3
-- Stability: experimental
-- Portability: portable
module Main where

-- |
--
--Here is a snippet:
-- Here is a snippet:
--
--@
--x = y + 2
--@
-- @
-- x = y + 2
-- @
x = y + 2
2 changes: 1 addition & 1 deletion data/examples/other/following-comment-last-3-four-out.hs
Expand Up @@ -3,5 +3,5 @@ module Main where
-- | Another datatype...
data D'
{- ^ ...with two docstrings.
even on second line
even on second line
-}
6 changes: 3 additions & 3 deletions data/examples/other/haddock-sections-four-out.hs
@@ -1,9 +1,9 @@
{- $weird #anchor#
Section 1
Section 1
-}

{- $normal
{- $normal
Section 2
Section 2
-}
@@ -1,5 +1,5 @@
{- | This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{- | This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{- |
{- |
This is a multiline
function haddock
-}
multi2 :: Int

{- | This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
@@ -1,5 +1,5 @@
{-| This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{- | This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{- |
{- |
This is a multiline
function haddock
-}
multi2 :: Int

{- | This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
Expand Up @@ -9,22 +9,22 @@ single1 :: Int
single2 :: Int

{- | This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{- |
{- |
This is a multiline
function haddock
-}
multi2 :: Int

{- | This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
10 changes: 5 additions & 5 deletions data/fourmolu/haddock-style/output-HaddockMultiLine.hs
@@ -1,5 +1,5 @@
{- | This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{- | This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{- |
{- |
This is a multiline
function haddock
-}
multi2 :: Int

{- | This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
@@ -1,5 +1,5 @@
{- | This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{-| This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{-|
{-|
This is a multiline
function haddock
-}
multi2 :: Int

{-| This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
@@ -1,5 +1,5 @@
{-| This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{-| This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{-|
{-|
This is a multiline
function haddock
-}
multi2 :: Int

{-| This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
Expand Up @@ -9,22 +9,22 @@ single1 :: Int
single2 :: Int

{-| This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{-|
{-|
This is a multiline
function haddock
-}
multi2 :: Int

{-| This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
10 changes: 5 additions & 5 deletions data/fourmolu/haddock-style/output-HaddockMultiLineCompact.hs
@@ -1,5 +1,5 @@
{-| This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -10,22 +10,22 @@ single1 :: Int
single2 :: Int

{-| This is a multiline
function haddock
function haddock
-}
multi1 :: Int

{-|
{-|
This is a multiline
function haddock
-}
multi2 :: Int

{-| This is a haddock
with two consecutive newlines
with two consecutive newlines
https://github.com/fourmolu/fourmolu/issues/172
https://github.com/fourmolu/fourmolu/issues/172
-}
foo :: Int
foo = 42
@@ -1,5 +1,5 @@
{- | This is a test multiline
module haddock
module haddock
-}
module Foo where

Expand All @@ -14,8 +14,8 @@ single2 :: Int
multi1 :: Int

-- |
--This is a multiline
--function haddock
-- This is a multiline
-- function haddock
multi2 :: Int

-- | This is a haddock
Expand Down

0 comments on commit a9c377b

Please sign in to comment.