Skip to content

Commit 556c8a3

Browse files
committed
Fix -Wall and -Wunused-packages in eval plugin
1 parent 276dfd3 commit 556c8a3

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

plugins/hls-eval-plugin/hls-eval-plugin.cabal

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ source-repository head
3636
type: git
3737
location: https://github.com/haskell/haskell-language-server
3838

39+
common warnings
40+
ghc-options:
41+
-Wall -Wunused-packages -Wno-name-shadowing -fno-ignore-asserts
42+
3943
library
44+
import: warnings
4045
exposed-modules:
4146
Ide.Plugin.Eval
4247
Ide.Plugin.Eval.Types
@@ -57,18 +62,14 @@ library
5762
, base >=4.12 && <5
5863
, bytestring
5964
, containers
60-
, data-default
6165
, deepseq
6266
, Diff ^>=0.4.0
63-
, directory
6467
, dlist
6568
, extra
6669
, filepath
6770
, ghc
6871
, ghc-boot-th
69-
, ghc-paths
7072
, ghcide == 2.6.0.0
71-
, hashable
7273
, hls-graph
7374
, hls-plugin-api == 2.6.0.0
7475
, lens
@@ -77,18 +78,11 @@ library
7778
, megaparsec >=9.0
7879
, mtl
7980
, parser-combinators >=1.2
80-
, pretty-simple
81-
, QuickCheck
82-
, safe-exceptions
8381
, text
84-
, time
8582
, transformers
8683
, unliftio
8784
, unordered-containers
8885

89-
ghc-options:
90-
-Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors -fno-ignore-asserts
91-
9286
if flag(pedantic)
9387
ghc-options: -Werror
9488

@@ -98,6 +92,7 @@ library
9892
TypeOperators
9993

10094
test-suite tests
95+
import: warnings
10196
type: exitcode-stdio-1.0
10297
default-language: Haskell2010
10398
hs-source-dirs: test
@@ -107,7 +102,6 @@ test-suite tests
107102
, aeson
108103
, base
109104
, containers
110-
, directory
111105
, extra
112106
, filepath
113107
, hls-eval-plugin

plugins/hls-eval-plugin/test/Main.hs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module Main
99
) where
1010

1111
import Control.Lens (_Just, folded, preview,
12-
toListOf, view, (^..))
12+
view, (^..), (^.))
1313
import Data.Aeson (Value (Object), fromJSON,
14-
object, toJSON, (.=))
14+
object, (.=))
1515
import Data.Aeson.Types (Pair, Result (Success))
1616
import Data.List (isInfixOf)
1717
import Data.List.Extra (nubOrdOn)
@@ -23,10 +23,7 @@ import qualified Ide.Plugin.Config as Plugin
2323
import qualified Ide.Plugin.Eval as Eval
2424
import Ide.Plugin.Eval.Types (EvalParams (..), Section (..),
2525
testOutput)
26-
import Ide.Types (IdePlugins (IdePlugins))
27-
import Language.LSP.Protocol.Lens (arguments, command, range,
28-
title)
29-
import Language.LSP.Protocol.Message hiding (error)
26+
import Language.LSP.Protocol.Lens (command, range, title)
3027
import System.FilePath ((<.>), (</>))
3128
import Test.Hls
3229
import qualified Test.Hls.FileSystem as FS
@@ -215,16 +212,17 @@ tests =
215212
, testCase "Interfaces are reused after Eval" $ do
216213
runSessionWithServerInTmpDir def evalPlugin (mkFs $ FS.directProjectMulti ["TLocalImport.hs", "Util.hs"]) $ do
217214
doc <- openDoc "TLocalImport.hs" "haskell"
218-
waitForTypecheck doc
215+
_ <- waitForTypecheck doc
219216
lenses <- getCodeLenses doc
220-
let ~cmds@[cmd] = lenses^..folded.command._Just
221-
liftIO $ cmds^..folded.title @?= ["Evaluate..."]
217+
cmd <- liftIO $ case lenses^..folded.command._Just of
218+
[cmd] -> (cmd^.title @?= "Evaluate...") >> pure cmd
219+
cmds -> assertFailure $ "Expected a single command, got " <> show (length cmds)
222220

223221
executeCmd cmd
224222

225223
-- trigger a rebuild and check that dependency interfaces are not rebuilt
226224
changeDoc doc []
227-
waitForTypecheck doc
225+
_ <- waitForTypecheck doc
228226
Right keys <- getLastBuildKeys
229227
let ifaceKeys = filter ("GetModIface" `T.isPrefixOf`) keys
230228
liftIO $ ifaceKeys @?= []

0 commit comments

Comments
 (0)