@@ -67,6 +67,7 @@ import qualified Development.IDE.Types.Logger as L
6767
6868import qualified Data.Binary as B
6969import qualified Data.ByteString.Lazy as LBS
70+ import Development.IDE.Core.IdeConfiguration (isWorkspaceFile )
7071import Language.LSP.Server hiding
7172 (getVirtualFile )
7273import qualified Language.LSP.Server as LSP
@@ -127,16 +128,23 @@ getModificationTimeImpl vfs isWatched missingFileDiags file = do
127128 let file' = fromNormalizedFilePath file
128129 let wrap time@ (l,s) = (Just $ LBS. toStrict $ B. encode time, ([] , Just $ ModificationTime l s))
129130 mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
130- -- we use 'getVirtualFile' to discriminate FOIs so make that
131- -- dependency explicit by using the IsFileOfInterest rule
132- _ <- use_ IsFileOfInterest file
133131 case mbVirtual of
134132 Just (virtualFileVersion -> ver) -> do
135133 alwaysRerun
136134 pure (Just $ LBS. toStrict $ B. encode ver, ([] , Just $ VFSVersion ver))
137135 Nothing -> do
138136 isWF <- isWatched file
139- unless (isWF || isInterface file) 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+
140148 liftIO $ fmap wrap (getModTime file')
141149 `catch` \ (e :: IOException ) -> do
142150 let err | isDoesNotExistError e = " File does not exist: " ++ file'
0 commit comments