Skip to content

Commit 035edc8

Browse files
committed
Clarify logic
1 parent bf61949 commit 035edc8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,17 @@ getModificationTimeImpl vfs isWatched missingFileDiags file = do
134134
pure (Just $ LBS.toStrict $ B.encode ver, ([], Just $ VFSVersion ver))
135135
Nothing -> do
136136
isWF <- isWatched file
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
137+
if isWF
138+
then -- the file is watched so we can rely on FileWatched notifications,
139+
-- but also need a dependency on IsFileOfInterest to reinstall
140+
-- alwaysRerun when the file becomes VFS
141+
void (use_ IsFileOfInterest file)
142+
else if isInterface file
143+
then -- interface files are tracked specially using the closed world assumption
144+
pure ()
145+
else -- in all other cases we will need to freshly check the file system
146+
alwaysRerun
147+
142148
when (isWF && not (isInterface file)) $
143149
-- we use 'getVirtualFile' to discriminate FOIs so make that dependency explicit
144150
void $ use_ IsFileOfInterest file

0 commit comments

Comments
 (0)