@@ -13,7 +13,7 @@ module Development.IDE.State.Service(
1313 getServiceEnv ,
1414 IdeState , initialise , shutdown ,
1515 runAction , runActions ,
16- setFilesOfInterest ,
16+ setFilesOfInterest , modifyFilesOfInterest ,
1717 writeProfile ,
1818 getDiagnostics , unsafeClearDiagnostics ,
1919 logDebug , logSeriousError
@@ -26,6 +26,8 @@ import Development.IDE.State.FileStore
2626import qualified Development.IDE.Logger as Logger
2727import Data.Set (Set )
2828import qualified Data.Set as Set
29+ import qualified Data.Text as T
30+ import Data.Tuple.Extra
2931import Development.IDE.Functions.GHCError
3032import Development.IDE.Types.Diagnostics (NormalizedFilePath )
3133import Development.Shake hiding (Diagnostic , Env , newCache )
@@ -109,12 +111,13 @@ runActions x = join . shakeRun x
109111
110112-- | Set the files-of-interest which will be built and kept-up-to-date.
111113setFilesOfInterest :: IdeState -> Set NormalizedFilePath -> IO ()
112- setFilesOfInterest state files = do
113- Env {.. } <- getIdeGlobalState state
114- -- update vars synchronously
115- modifyVar_ envOfInterestVar $ const $ return files
114+ setFilesOfInterest state files = modifyFilesOfInterest state (const files)
116115
117- -- run shake to update results regarding the files of interest
116+ modifyFilesOfInterest :: IdeState -> (Set NormalizedFilePath -> Set NormalizedFilePath ) -> IO ()
117+ modifyFilesOfInterest state f = do
118+ Env {.. } <- getIdeGlobalState state
119+ files <- modifyVar envOfInterestVar $ pure . dupe . f
120+ logDebug state $ " Set files of interest to: " <> T. pack (show $ Set. toList files)
118121 void $ shakeRun state []
119122
120123getServiceEnv :: Action Env
0 commit comments