@@ -67,6 +67,7 @@ import qualified Development.IDE.Types.Logger as L
67
67
68
68
import qualified Data.Binary as B
69
69
import qualified Data.ByteString.Lazy as LBS
70
+ import Development.IDE.Core.IdeConfiguration (isWorkspaceFile )
70
71
import Language.LSP.Server hiding
71
72
(getVirtualFile )
72
73
import qualified Language.LSP.Server as LSP
@@ -127,16 +128,23 @@ getModificationTimeImpl vfs isWatched missingFileDiags file = do
127
128
let file' = fromNormalizedFilePath file
128
129
let wrap time@ (l,s) = (Just $ LBS. toStrict $ B. encode time, ([] , Just $ ModificationTime l s))
129
130
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
133
131
case mbVirtual of
134
132
Just (virtualFileVersion -> ver) -> do
135
133
alwaysRerun
136
134
pure (Just $ LBS. toStrict $ B. encode ver, ([] , Just $ VFSVersion ver))
137
135
Nothing -> do
138
136
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
+
140
148
liftIO $ fmap wrap (getModTime file')
141
149
`catch` \ (e :: IOException ) -> do
142
150
let err | isDoesNotExistError e = " File does not exist: " ++ file'
0 commit comments