Skip to content

Commit

Permalink
Avoid unnecessarily dirtying IsFileOfInterest
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed May 26, 2021
1 parent ac1c346 commit ff22098
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ghcide/src/Development/IDE/Core/OfInterest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ getFilesOfInterestUntracked = do
addFileOfInterest :: IdeState -> NormalizedFilePath -> FileOfInterestStatus -> IO ()
addFileOfInterest state f v = do
OfInterestVar var <- getIdeGlobalState state
files <- modifyVar' var $ HashMap.insert f v
recordDirtyKeys (shakeExtras state) IsFileOfInterest [f]
logDebug (ideLogger state) $ "Set files of interest to: " <> T.pack (show files)
(prev, files) <- modifyVar var $ \dict -> do
let (prev, new) = HashMap.alterF (, Just v) f dict
pure (new, (prev, dict))
when (prev /= Just v) $
recordDirtyKeys (shakeExtras state) IsFileOfInterest [f]
logDebug (ideLogger state) $
"Set files of interest to: " <> T.pack (show files)

deleteFileOfInterest :: IdeState -> NormalizedFilePath -> IO ()
deleteFileOfInterest state f = do
Expand Down

0 comments on commit ff22098

Please sign in to comment.