@@ -14,6 +14,7 @@ module Development.IDE.Core.FileStore(
14 makeLSPVFSHandle
14 makeLSPVFSHandle
17import Development.IDE.GHC.Orphans()
18import Development.IDE.GHC.Orphans()
18import Development.IDE.Core.Shake
19import Development.IDE.Core.Shake
19import Control.Concurrent.Extra
20import Control.Concurrent.Extra
@@ -95,13 +96,15 @@ getModificationTimeRule :: VFSHandle -> Rules ()
95getModificationTimeRule vfs =
96getModificationTimeRule vfs =
96 defineEarlyCutoff $ \GetModificationTime file -> do
97 defineEarlyCutoff $ \GetModificationTime file -> do
97 let file' = fromNormalizedFilePath file
98 let file' = fromNormalizedFilePath file
99+ let wrap time@(l,s) = do
100+ hPutStrLn stderr (show $ BS.pack $ show time)
98− let wrap time@(l,s) = (Just $ BS.pack $ show time, ([], Just $ ModificationTime l s))
101+ pure (Just $ BS.pack $ show time, ([], Just $ ModificationTime l s))
99 alwaysRerun
102 alwaysRerun
100 mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
103 mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
101 case mbVirtual of
104 case mbVirtual of
102 Just (virtualFileVersion -> ver) ->
105 Just (virtualFileVersion -> ver) ->
103 pure (Just $ BS.pack $ show ver, ([], Just $ VFSVersion ver))
106 pure (Just $ BS.pack $ show ver, ([], Just $ VFSVersion ver))
104− Nothing -> liftIO $ fmap wrap (getModTime file')
107+ Nothing -> liftIO $ (wrap =<< getModTime file')
105 `catch` \(e :: IOException) -> do
108 `catch` \(e :: IOException) -> do
106 let err | isDoesNotExistError e = "File does not exist: " ++ file'
109 let err | isDoesNotExistError e = "File does not exist: " ++ file'
107 | otherwise = "IO error while reading " ++ file' ++ ", " ++ displayException e
110 | otherwise = "IO error while reading " ++ file' ++ ", " ++ displayException e
@@ -130,6 +133,7 @@ getModificationTimeRule vfs =
130 Posix.throwErrnoPathIfMinus1Retry_ "getmodtime" f $ c_getModTime f' secPtr nsecPtr
133 Posix.throwErrnoPathIfMinus1Retry_ "getmodtime" f $ c_getModTime f' secPtr nsecPtr
131 sec <- peek secPtr
134 sec <- peek secPtr
132 nsec <- peek nsecPtr
135 nsec <- peek nsecPtr
136+ hPutStrLn stderr (show (f, sec, nsec))
133 pure (fromEnum sec, fromIntegral nsec)
137 pure (fromEnum sec, fromIntegral nsec)
135-- Sadly even unix’s getFileStatus + modificationTimeHiRes is still about twice as slow
139-- Sadly even unix’s getFileStatus + modificationTimeHiRes is still about twice as slow