Skip to content

Commit 0cca5db

Browse files
committed
Add Brittany to ghc-8.10.1
1 parent 155c01d commit 0cca5db

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

exe/Main.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import Ide.Plugin.Fourmolu as Fourmolu
7171
import Ide.Plugin.Ormolu as Ormolu
7272
import Ide.Plugin.StylishHaskell as StylishHaskell
7373
import Ide.Plugin.Retrie as Retrie
74-
#if AGPL && !MIN_VERSION_ghc(8,10,1)
74+
#if AGPL
7575
import Ide.Plugin.Brittany as Brittany
7676
#endif
7777
import Ide.Plugin.Pragmas as Pragmas
@@ -110,9 +110,7 @@ idePlugins includeExamples = pluginDescToIdePlugins allPlugins
110110
, StylishHaskell.descriptor "stylish-haskell"
111111
, Retrie.descriptor "retrie"
112112
#if AGPL
113-
#if !MIN_VERSION_ghc(8,10,1)
114113
, Brittany.descriptor "brittany"
115-
#endif
116114
#endif
117115
, Eval.descriptor "eval"
118116
]

haskell-language-server.cabal

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ library
103103
else
104104
build-depends: unix
105105
if flag(agpl)
106-
if impl(ghc < 8.10)
107-
build-depends:
108-
brittany
109-
exposed-modules:
110-
Ide.Plugin.Brittany
106+
build-depends:
107+
brittany
108+
exposed-modules:
109+
Ide.Plugin.Brittany
111110

112111
ghc-options:
113112
-Wall

test/functional/Format.hs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import Test.Tasty
1212
import Test.Tasty.Golden
1313
import Test.Tasty.HUnit
1414

15-
#if MIN_VERSION_GLASGOW_HASKELL(8,10,0,0) || !defined(AGPL)
16-
#else
15+
#if AGPL
1716
import qualified Data.Text.IO as T
1817
#endif
1918

@@ -30,9 +29,7 @@ tests = testGroup "format document" [
3029
, rangeTests
3130
, providerTests
3231
, stylishHaskellTests
33-
-- There's no Brittany formatter on the 8.10.1 builds (yet)
34-
#if MIN_VERSION_GLASGOW_HASKELL(8,10,0,0) || !defined(AGPL)
35-
#else
32+
#if AGPL
3633
, brittanyTests
3734
#endif
3835
, ormoluTests
@@ -63,9 +60,7 @@ providerTests = testGroup "formatting provider" [
6360
formatRange doc (FormattingOptions 2 True) (Range (Position 1 0) (Position 3 10))
6461
documentContents doc >>= liftIO . (@?= orig)
6562

66-
-- There's no Brittany formatter on the 8.10.1 builds (yet)
67-
#if MIN_VERSION_GLASGOW_HASKELL(8,10,0,0) || !defined(AGPL)
68-
#else
63+
#if AGPL
6964
, testCase "can change on the fly" $ runSession hieCommand fullCaps "test/testdata" $ do
7065
formattedBrittany <- liftIO $ T.readFile "test/testdata/Format.brittany.formatted.hs"
7166
formattedFloskell <- liftIO $ T.readFile "test/testdata/Format.floskell.formatted.hs"
@@ -114,8 +109,7 @@ stylishHaskellTests = testGroup "stylish-haskell" [
114109
BS.fromStrict . T.encodeUtf8 <$> documentContents doc
115110
]
116111

117-
#if MIN_VERSION_GLASGOW_HASKELL(8,10,0,0) || !defined(AGPL)
118-
#else
112+
#if AGPL
119113
brittanyTests :: TestTree
120114
brittanyTests = testGroup "brittany" [
121115
goldenVsStringDiff "formats a document with LF endings" goldenGitDiff "test/testdata/BrittanyLF.formatted_document.hs" $ runSession hieCommand fullCaps "test/testdata" $ do
@@ -177,8 +171,7 @@ fourmoluTests = testGroup "fourmolu"
177171
formatLspConfig :: Value -> Value
178172
formatLspConfig provider = object [ "haskell" .= object ["formattingProvider" .= (provider :: Value)] ]
179173

180-
#if MIN_VERSION_GLASGOW_HASKELL(8,10,0,0) || !defined(AGPL)
181-
#else
174+
#if AGPL
182175
-- | The same as 'formatLspConfig' but using the legacy section name
183176
formatLspConfigOld :: Value -> Value
184177
formatLspConfigOld provider = object [ "languageServerHaskell" .= object ["formattingProvider" .= (provider :: Value)] ]

test/testdata/Format.brittany.formatted.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ bar s = do
1111
x <- return "hello"
1212
return "asdf"
1313

14-
data Baz = Baz { a :: Int, b :: String }
14+
data Baz = Baz
15+
{ a :: Int
16+
, b :: String
17+
}
1518

test/testdata/Format.brittany_post_floskell.formatted.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ bar s = do
1313
x <- return "hello"
1414
return "asdf"
1515

16-
data Baz = Baz { a :: Int, b :: String }
16+
data Baz = Baz
17+
{ a :: Int
18+
, b :: String
19+
}
1720

0 commit comments

Comments
 (0)