@@ -15,7 +15,7 @@ module Development.IDE.Core.OfInterest(
1515 kick , FileOfInterestStatus (.. ),
1616 OfInterestVar (.. ),
1717 scheduleGarbageCollection ,
18- Log (.. )
18+ Log (.. ), doKick
1919 ) where
2020
2121import Control.Concurrent.Strict
@@ -39,7 +39,7 @@ import Development.IDE.Plugin.Completions.Types
3939import Development.IDE.Types.Exports
4040import Development.IDE.Types.Location
4141import Development.IDE.Types.Options (IdeTesting (.. ))
42- import Development.IDE.Types.Shake (toKey )
42+ import Development.IDE.Types.Shake (toKey , toNoFileKey )
4343import GHC.TypeLits (KnownSymbol )
4444import Ide.Logger (Pretty (pretty ),
4545 Priority (.. ),
@@ -66,6 +66,10 @@ ofInterestRules :: Recorder (WithPriority Log) -> Rules ()
6666ofInterestRules recorder = do
6767 addIdeGlobal . OfInterestVar =<< liftIO (newVar HashMap. empty)
6868 addIdeGlobal . GarbageCollectVar =<< liftIO (newVar False )
69+ -- A no-file rule to perform the global kick action
70+ defineEarlyCutOffNoFile (cmapWithPrio LogShake recorder) $ \ Kick -> do
71+ kick
72+ pure (" " , () )
6973 defineEarlyCutoff (cmapWithPrio LogShake recorder) $ RuleNoDiagnostics $ \ IsFileOfInterest f -> do
7074 alwaysRerun
7175 filesOfInterest <- getFilesOfInterestUntracked
@@ -113,7 +117,7 @@ addFileOfInterest state f v = do
113117 then do
114118 logWith (ideLogger state) Debug $
115119 LogSetFilesOfInterest (HashMap. toList files)
116- return [toKey IsFileOfInterest f]
120+ return [toKey IsFileOfInterest f, toNoFileKey Kick ]
117121 else return []
118122
119123deleteFileOfInterest :: IdeState -> NormalizedFilePath -> IO [Key ]
@@ -122,12 +126,21 @@ deleteFileOfInterest state f = do
122126 files <- modifyVar' var $ HashMap. delete f
123127 logWith (ideLogger state) Debug $
124128 LogSetFilesOfInterest (HashMap. toList files)
125- return [toKey IsFileOfInterest f]
129+ return [toKey IsFileOfInterest f, toNoFileKey Kick ]
126130scheduleGarbageCollection :: IdeState -> IO ()
127131scheduleGarbageCollection state = do
128132 GarbageCollectVar var <- getIdeGlobalState state
129133 writeVar var True
130134
135+ doKick :: Action ()
136+ doKick = do
137+ ShakeExtras {ideTesting = IdeTesting testing} <- getShakeExtras
138+ -- only kick always if testing, otherwise we rely on the kick rule
139+ if testing
140+ then kick
141+ else void $ useNoFile Kick
142+
143+
131144-- | Typecheck all the files of interest.
132145-- Could be improved
133146kick :: Action ()
0 commit comments