Skip to content

Commit 0bf4e91

Browse files
authored
Refactoring: remove isTesting from ShakeExtras (#469)
isTesting got added to ShakeExtras unnecessarily
1 parent da92de2 commit 0bf4e91

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

exe/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ main = do
9595
let options = (defaultIdeOptions $ loadSession dir)
9696
{ optReportProgress = clientSupportsProgress caps
9797
, optShakeProfiling = argsShakeProfiling
98-
, optTesting = IdeTesting argsTesting
98+
, optTesting = argsTesting
9999
}
100100
debouncer <- newAsyncDebouncer
101101
initialise caps (cradleRules >> mainRule >> pluginRules plugins >> action kick)

exe/Rules.hs

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import Data.Functor ((<&>))
1616
import Data.Maybe (fromMaybe)
1717
import Data.Text (Text)
1818
import Development.IDE.Core.Rules (defineNoFile)
19-
import Development.IDE.Core.Shake (ShakeExtras(ShakeExtras,isTesting), getShakeExtras, sendEvent, define, useNoFile_)
19+
import Development.IDE.Core.Service (getIdeOptions)
20+
import Development.IDE.Core.Shake (sendEvent, define, useNoFile_)
2021
import Development.IDE.GHC.Util
2122
import Development.IDE.Types.Location (fromNormalizedFilePath)
23+
import Development.IDE.Types.Options (IdeOptions(IdeOptions, optTesting))
2224
import Development.Shake
2325
import DynFlags (gopt_set, gopt_unset,
2426
updOptLevel)
@@ -60,13 +62,13 @@ cradleToSession :: Rules ()
6062
cradleToSession = define $ \LoadCradle nfp -> do
6163
let f = fromNormalizedFilePath nfp
6264

63-
ShakeExtras{isTesting} <- getShakeExtras
65+
IdeOptions{optTesting} <- getIdeOptions
6466

6567
-- If the path points to a directory, load the implicit cradle
6668
mbYaml <- doesDirectoryExist f <&> \isDir -> if isDir then Nothing else Just f
6769
cradle <- liftIO $ maybe (loadImplicitCradle $ addTrailingPathSeparator f) loadCradle mbYaml
6870

69-
when isTesting $
71+
when optTesting $
7072
sendEvent $ notifyCradleLoaded f
7173

7274
cmpOpts <- liftIO $ getComponentOptions cradle

src/Development/IDE/Core/Service.hs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ initialise caps mainRule getLspId toDiags logger debouncer options vfs =
6161
logger
6262
debouncer
6363
(optShakeProfiling options)
64-
(optTesting options)
6564
(optReportProgress options)
6665
shakeOptions
6766
{ shakeThreads = optThreads options

src/Development/IDE/Core/Shake.hs

+1-4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ data ShakeExtras = ShakeExtras
102102
-- positions in a version of that document to positions in the latest version
103103
,inProgress :: Var (HMap.HashMap NormalizedFilePath Int)
104104
-- ^ How many rules are running for each file
105-
,isTesting :: Bool
106-
-- ^ enable additional messages used by the test suite to check invariants
107105
}
108106

109107
getShakeExtras :: Action ShakeExtras
@@ -299,12 +297,11 @@ shakeOpen :: IO LSP.LspId
299297
-> Logger
300298
-> Debouncer NormalizedUri
301299
-> Maybe FilePath
302-
-> IdeTesting
303300
-> IdeReportProgress
304301
-> ShakeOptions
305302
-> Rules ()
306303
-> IO IdeState
307-
shakeOpen getLspId eventer logger debouncer shakeProfileDir (IdeTesting isTesting) (IdeReportProgress reportProgress) opts rules = do
304+
shakeOpen getLspId eventer logger debouncer shakeProfileDir (IdeReportProgress reportProgress) opts rules = do
308305
inProgress <- newVar HMap.empty
309306
shakeExtras <- do
310307
globals <- newVar HMap.empty

src/Development/IDE/Types/Options.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module Development.IDE.Types.Options
99
, IdePreprocessedSource(..)
1010
, IdeReportProgress(..)
1111
, IdeDefer(..)
12-
, IdeTesting(..)
1312
, clientSupportsProgress
1413
, IdePkgLocationOptions(..)
1514
, defaultIdeOptions
@@ -41,7 +40,7 @@ data IdeOptions = IdeOptions
4140
-- meaning we keep everything in memory but the daml CLI compiler uses this for incremental builds.
4241
, optShakeProfiling :: Maybe FilePath
4342
-- ^ Set to 'Just' to create a directory of profiling reports.
44-
, optTesting :: IdeTesting
43+
, optTesting :: Bool
4544
-- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
4645
, optReportProgress :: IdeReportProgress
4746
-- ^ Whether to report progress during long operations.
@@ -68,7 +67,6 @@ data IdePreprocessedSource = IdePreprocessedSource
6867

6968
newtype IdeReportProgress = IdeReportProgress Bool
7069
newtype IdeDefer = IdeDefer Bool
71-
newtype IdeTesting = IdeTesting Bool
7270

7371
clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
7472
clientSupportsProgress caps = IdeReportProgress $ Just True ==
@@ -87,7 +85,7 @@ defaultIdeOptions session = IdeOptions
8785
,optLanguageSyntax = "haskell"
8886
,optNewColonConvention = False
8987
,optDefer = IdeDefer True
90-
,optTesting = IdeTesting False
88+
,optTesting = False
9189
}
9290

9391

0 commit comments

Comments
 (0)