Skip to content

Commit bf61949

Browse files
committed
Only add the IsFileOfInterest dependency when needed
1 parent 3d7195d commit bf61949

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ghcide/src/Development/IDE/Core/FileStore.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,20 @@ getModificationTimeImpl vfs isWatched missingFileDiags file = do
128128
let file' = fromNormalizedFilePath file
129129
let wrap time@(l,s) = (Just $ LBS.toStrict $ B.encode time, ([], Just $ ModificationTime l s))
130130
mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
131-
-- we use 'getVirtualFile' to discriminate FOIs so make that
132-
-- dependency explicit by using the IsFileOfInterest rule
133-
isWF <- isWorkspaceFile file
134-
when isWF $ void $ use_ IsFileOfInterest file
135131
case mbVirtual of
136132
Just (virtualFileVersion -> ver) -> do
137133
alwaysRerun
138134
pure (Just $ LBS.toStrict $ B.encode ver, ([], Just $ VFSVersion ver))
139135
Nothing -> do
140136
isWF <- isWatched file
141-
unless (isWF || isInterface file) alwaysRerun
137+
unless (isWF || isInterface file)
138+
-- If the file is watched, we don't need alwaysRerun.
139+
-- Interface files are not watched by the LSP client but
140+
-- we keep track of their freshness, so no alwaysRerun
141+
alwaysRerun
142+
when (isWF && not (isInterface file)) $
143+
-- we use 'getVirtualFile' to discriminate FOIs so make that dependency explicit
144+
void $ use_ IsFileOfInterest file
142145
liftIO $ fmap wrap (getModTime file')
143146
`catch` \(e :: IOException) -> do
144147
let err | isDoesNotExistError e = "File does not exist: " ++ file'

0 commit comments

Comments
 (0)