Skip to content

Commit

Permalink
Fix -Wall and -Wunused-packages in fourmolu and ormolu plugins (haske…
Browse files Browse the repository at this point in the history
…ll#4007)

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
  • Loading branch information
jhrcek and michaelpj authored Jan 23, 2024
1 parent 3fa2f7c commit d6553e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 6 additions & 4 deletions plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ source-repository head
type: git
location: git://github.com/haskell/haskell-language-server.git

common warnings
ghc-options: -Wall -Wunused-packages

library
import: warnings
exposed-modules:
Ide.Plugin.Fourmolu
hs-source-dirs: src
ghc-options: -Wall
build-depends:
, base >=4.12 && <5
, filepath
, fourmolu ^>= 0.14
, ghc
, ghc-boot-th
, ghcide == 2.6.0.0
, hls-plugin-api == 2.6.0.0
Expand All @@ -45,17 +47,17 @@ library
default-language: Haskell2010

test-suite tests
import: warnings
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: test
main-is: Main.hs
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-tool-depends:
fourmolu:fourmolu
build-depends:
, base >=4.12 && <5
, aeson
, containers
, filepath
, hls-fourmolu-plugin
, hls-plugin-api
Expand Down
9 changes: 5 additions & 4 deletions plugins/hls-ormolu-plugin/hls-ormolu-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ source-repository head
type: git
location: https://github.com/haskell/haskell-language-server.git

common warnings
ghc-options: -Wall -Wunused-packages

library
import: warnings
exposed-modules: Ide.Plugin.Ormolu
hs-source-dirs: src
build-depends:
, base >=4.12 && <5
, extra
, filepath
, ghc
, ghc-boot-th
, ghcide == 2.6.0.0
, hls-plugin-api == 2.6.0.0
, lens
, lsp
, mtl
, process-extras >= 0.7.1
Expand All @@ -44,6 +46,7 @@ library
default-language: Haskell2010

test-suite tests
import: warnings
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: test
Expand All @@ -54,11 +57,9 @@ test-suite tests
build-depends:
, base
, aeson
, containers
, filepath
, hls-ormolu-plugin
, hls-plugin-api
, hls-test-utils == 2.6.0.0
, lsp-types
, text
, ormolu
8 changes: 2 additions & 6 deletions plugins/hls-ormolu-plugin/src/Ide/Plugin/Ormolu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ where
import Control.Exception (Handler (..), IOException,
SomeException (..), catches,
handle)
import Control.Monad.Except (ExceptT (ExceptT), runExceptT,
throwError)
import Control.Monad.Except (runExceptT, throwError)
import Control.Monad.Extra
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans
import Control.Monad.Trans.Except (ExceptT (..), mapExceptT,
runExceptT)
import Control.Monad.Trans.Except (ExceptT (..), mapExceptT)
import Data.Functor ((<&>))
import Data.List (intercalate)
import Data.Maybe (catMaybes)
Expand All @@ -38,7 +35,6 @@ import Ide.Plugin.Properties
import Ide.PluginUtils
import Ide.Types hiding (Config)
import qualified Ide.Types as Types
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types
import Language.LSP.Server hiding (defaultConfig)
import Ormolu
Expand Down
7 changes: 4 additions & 3 deletions plugins/hls-ormolu-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Main
) where

import Data.Aeson
import qualified Data.Aeson.KeyMap as KM
import Data.Functor
import qualified Data.Text as T
import Ide.Plugin.Config
import qualified Ide.Plugin.Ormolu as Ormolu
import Language.LSP.Protocol.Types
Expand Down Expand Up @@ -34,9 +34,10 @@ tests = testGroup "ormolu" $
]

goldenWithOrmolu :: Bool -> TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
goldenWithOrmolu cli title path desc = goldenWithHaskellDocFormatter def ormoluPlugin "ormolu" def title testDataDir path desc "hs"
goldenWithOrmolu cli title path desc =
goldenWithHaskellDocFormatter def ormoluPlugin "ormolu" conf title testDataDir path desc "hs"
where
conf = def{plcConfig = (\(Object obj) -> obj) $ object ["external" .= cli]}
conf = def{plcConfig = KM.fromList ["external" .= cli]}

testDataDir :: FilePath
testDataDir = "test" </> "testdata"

0 comments on commit d6553e0

Please sign in to comment.