diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2020-10-07 12:54:13 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2020-10-07 12:55:00 +0200 |
commit | 986cea995f0272f4db470b24bf390ffc8edaeb00 (patch) | |
tree | d46c4195988279d5e77746515c7000cf257dabb6 | |
parent | f6c3800c1a7896ae289374f8f637cbad25ae1f38 (diff) | |
download | stylish-haskell-986cea995f0272f4db470b24bf390ffc8edaeb00.tar.gz |
Imports: Respect separate_lists for (..) imports
Fixes #320
-rw-r--r-- | lib/Language/Haskell/Stylish/Step/Imports.hs | 6 | ||||
-rw-r--r-- | tests/Language/Haskell/Stylish/Step/Imports/Tests.hs | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/Language/Haskell/Stylish/Step/Imports.hs b/lib/Language/Haskell/Stylish/Step/Imports.hs index 9c1d82d..f2439dc 100644 --- a/lib/Language/Haskell/Stylish/Step/Imports.hs +++ b/lib/Language/Haskell/Stylish/Step/Imports.hs @@ -309,13 +309,13 @@ printQualified Options{..} padNames stats (L _ decl) = do -------------------------------------------------------------------------------- printImport :: Options -> IE GhcPs -> P () -printImport Options{..} (IEVar _ name) = do +printImport _ (IEVar _ name) = do printIeWrappedName name printImport _ (IEThingAbs _ name) = do printIeWrappedName name -printImport _ (IEThingAll _ name) = do +printImport Options{..} (IEThingAll _ name) = do printIeWrappedName name - space + when separateLists space putText "(..)" printImport _ (IEModuleContents _ (L _ m)) = do putText (moduleNameString m) diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs index 6521a8e..6889db4 100644 --- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs +++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs @@ -61,6 +61,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests" , testCase "case 27" case27 , testCase "case 28" case28 , testCase "case 29" case29 + , testCase "case 30" case30 ] @@ -834,3 +835,10 @@ case29 = assertSnippet (step Nothing $ fromImportAlign Group) , "" , "import A (A)" ] + + +-------------------------------------------------------------------------------- +case30 :: Assertion +case30 = assertSnippet (step Nothing defaultOptions {separateLists = False}) + ["import Data.Monoid (Monoid (..))"] + ["import Data.Monoid (Monoid(..))"] |