Skip to content

Commit df4e0ac

Browse files
cocreaturemergify[bot]
authored andcommitted
Remove one level of tracking files of interest and open VRs (haskell/ghcide#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.
1 parent 9911194 commit df4e0ac

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ghcide/src/Development/IDE/State/Service.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
2626
import qualified Development.IDE.Logger as Logger
2727
import Data.Set (Set)
2828
import qualified Data.Set as Set
29+
import qualified Data.Text as T
30+
import Data.Tuple.Extra
2931
import Development.IDE.Functions.GHCError
3032
import Development.IDE.Types.Diagnostics (NormalizedFilePath)
3133
import 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.
111113
setFilesOfInterest :: 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

120123
getServiceEnv :: Action Env

0 commit comments

Comments
 (0)