Remove one level of tracking files of interest and open VRs (#1650)

Previously we tracked this both at the Shake level and at the LSP
level which doesn’t make any sense. This PR removes the outer LSP
layer.
This commit is contained in:
Moritz Kiefer 2019-06-13 17:14:34 +02:00 committed by mergify[bot]
parent 794846dd28
commit 4300283193

View File

@ -13,7 +13,7 @@ module Development.IDE.State.Service(
getServiceEnv,
IdeState, initialise, shutdown,
runAction, runActions,
setFilesOfInterest,
setFilesOfInterest, modifyFilesOfInterest,
writeProfile,
getDiagnostics, unsafeClearDiagnostics,
logDebug, logSeriousError
@ -26,6 +26,8 @@ import Development.IDE.State.FileStore
import qualified Development.IDE.Logger as Logger
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Tuple.Extra
import Development.IDE.Functions.GHCError
import Development.IDE.Types.Diagnostics (NormalizedFilePath)
import Development.Shake hiding (Diagnostic, Env, newCache)
@ -109,12 +111,13 @@ runActions x = join . shakeRun x
-- | Set the files-of-interest which will be built and kept-up-to-date.
setFilesOfInterest :: IdeState -> Set NormalizedFilePath -> IO ()
setFilesOfInterest state files = do
Env{..} <- getIdeGlobalState state
-- update vars synchronously
modifyVar_ envOfInterestVar $ const $ return files
setFilesOfInterest state files = modifyFilesOfInterest state (const files)
-- run shake to update results regarding the files of interest
modifyFilesOfInterest :: IdeState -> (Set NormalizedFilePath -> Set NormalizedFilePath) -> IO ()
modifyFilesOfInterest state f = do
Env{..} <- getIdeGlobalState state
files <- modifyVar envOfInterestVar $ pure . dupe . f
logDebug state $ "Set files of interest to: " <> T.pack (show $ Set.toList files)
void $ shakeRun state []
getServiceEnv :: Action Env