Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 30a46e8

Browse files
authored
Avoid calling kick explicitly (#904)
* Avoid calling kick explicitly Leverages that rules are rerun by shakeRunDatabase. Allows users of ghcide as a library to use their own kick * Tweak doc comment
1 parent 9b8aaf9 commit 30a46e8

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

exe/Main.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import qualified Data.HashMap.Strict as HashMap
5050
import qualified Data.Aeson as J
5151

5252
import HIE.Bios.Cradle
53+
import Development.IDE (action)
5354

5455
ghcideVersion :: IO String
5556
ghcideVersion = do
@@ -113,7 +114,7 @@ main = do
113114
}
114115
logLevel = if argsVerbose then minBound else Info
115116
debouncer <- newAsyncDebouncer
116-
initialise caps (mainRule >> pluginRules plugins)
117+
initialise caps (mainRule >> pluginRules plugins >> action kick)
117118
getLspId event wProg wIndefProg (logger logLevel) debouncer options vfs
118119
else do
119120
-- GHC produces messages with UTF8 in them, so make sure the terminal doesn't error

session-loader/Development/IDE/Session.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import Data.IORef
3131
import Data.Maybe
3232
import Data.Time.Clock
3333
import Data.Version
34-
import Development.IDE.Core.OfInterest
3534
import Development.IDE.Core.Shake
3635
import Development.IDE.Core.RuleTypes
3736
import Development.IDE.GHC.Compat hiding (Target, TargetModule, TargetFile)
@@ -245,7 +244,7 @@ loadSession dir = do
245244

246245
-- Invalidate all the existing GhcSession build nodes by restarting the Shake session
247246
invalidateShakeCache
248-
restartShakeSession [kick]
247+
restartShakeSession []
249248

250249
-- Typecheck all files in the project on startup
251250
unless (null cs || not checkProject) $ do

src/Development/IDE/Core/FileStore.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import System.IO.Error
3636
import qualified Data.ByteString.Char8 as BS
3737
import Development.IDE.Types.Diagnostics
3838
import Development.IDE.Types.Location
39-
import Development.IDE.Core.OfInterest (getFilesOfInterest, kick)
39+
import Development.IDE.Core.OfInterest (getFilesOfInterest)
4040
import Development.IDE.Core.RuleTypes
4141
import Development.IDE.Types.Options
4242
import qualified Data.Rope.UTF16 as Rope
@@ -226,7 +226,7 @@ setFileModified state saved nfp = do
226226
VFSHandle{..} <- getIdeGlobalState state
227227
when (isJust setVirtualFileContents) $
228228
fail "setFileModified can't be called on this type of VFSHandle"
229-
shakeRestart state [kick]
229+
shakeRestart state []
230230
when checkParents $
231231
typecheckParents state nfp
232232

@@ -252,4 +252,4 @@ setSomethingModified state = do
252252
VFSHandle{..} <- getIdeGlobalState state
253253
when (isJust setVirtualFileContents) $
254254
fail "setSomethingModified can't be called on this type of VFSHandle"
255-
void $ shakeRestart state [kick]
255+
void $ shakeRestart state []

src/Development/IDE/Core/OfInterest.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ modifyFilesOfInterest state f = do
8888

8989
-- | Typecheck all the files of interest.
9090
-- Could be improved
91-
kick :: DelayedAction ()
92-
kick = mkDelayedAction "kick" Debug $ do
91+
kick :: Action ()
92+
kick = do
9393
files <- HashMap.keys <$> getFilesOfInterest
9494
ShakeExtras{progressUpdate} <- getShakeExtras
9595
liftIO $ progressUpdate KickStarted

src/Development/IDE/Types/Options.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ data IdeOptions = IdeOptions
9595
-- that the parsed module contains the result of Opt_KeepRawTokenStream,
9696
-- which might be necessary for hlint.
9797
, optCustomDynFlags :: DynFlags -> DynFlags
98-
-- ^ If given, it will be called right after setting up a new cradle,
98+
-- ^ Will be called right after setting up a new cradle,
9999
-- allowing to customize the Ghc options used
100100
}
101101

0 commit comments

Comments
 (0)