on master help sign in
print modtime
commitdde3c507fe1766b25887e104dace825f959cee67 authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateMon 6 Apr 2020, 19:44 (7 years ago) parent9b6e712
3 files changed+12−2
src/Development/IDE/Core/Compile.hs+2 src/Development/IDE/Core/FileStore.hs+6−2 src/Development/IDE/Core/Rules.hs+4
src/Development/IDE/Core/Compile.hs+2
@@ -68,6 +68,7 @@ import Data.Maybe
6868import Data.Tuple.Extra
6969import qualified Data.Map.Strict as Map
7070import System.FilePath
71+import System.IO
7172
7273
7374-- | Given a string buffer, return the string (after preprocessing) and the 'ParsedModule'.
@@ -81,6 +82,7 @@ parseModule IdeOptions{..} env filename mbContents =
8182 fmap (either (, Nothing) id) $
8283 runGhcEnv env $ runExceptT $ do
8384 (contents, dflags) <- preprocessor filename mbContents
85+ liftIO $ hPutStrLn stderr (show $ lexemeToString contents (len contents))
8486 (diag, modu) <- parseFileContents optPreprocessor dflags filename contents
8587 return (diag, Just (contents, modu))
8688
src/Development/IDE/Core/FileStore.hs+6−2
@@ -14,6 +14,7 @@ module Development.IDE.Core.FileStore(
1414 makeLSPVFSHandle
1515 ) where
1616
17+import System.IO
1718import Development.IDE.GHC.Orphans()
1819import Development.IDE.Core.Shake
1920import Control.Concurrent.Extra
@@ -95,13 +96,15 @@ getModificationTimeRule :: VFSHandle -> Rules ()
9596getModificationTimeRule vfs =
9697 defineEarlyCutoff $ \GetModificationTime file -> do
9798 let file' = fromNormalizedFilePath file
98− let wrap time@(l,s) = (Just $ BS.pack $ show time, ([], Just $ ModificationTime l s))
99+ let wrap time@(l,s) = do
100+ hPutStrLn stderr (show $ BS.pack $ show time)
101+ pure (Just $ BS.pack $ show time, ([], Just $ ModificationTime l s))
99102 alwaysRerun
100103 mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
101104 case mbVirtual of
102105 Just (virtualFileVersion -> ver) ->
103106 pure (Just $ BS.pack $ show ver, ([], Just $ VFSVersion ver))
104− Nothing -> liftIO $ fmap wrap (getModTime file')
107+ Nothing -> liftIO $ (wrap =<< getModTime file')
105108 `catch` \(e :: IOException) -> do
106109 let err | isDoesNotExistError e = "File does not exist: " ++ file'
107110 | otherwise = "IO error while reading " ++ file' ++ ", " ++ displayException e
@@ -130,6 +133,7 @@ getModificationTimeRule vfs =
130133 Posix.throwErrnoPathIfMinus1Retry_ "getmodtime" f $ c_getModTime f' secPtr nsecPtr
131134 sec <- peek secPtr
132135 nsec <- peek nsecPtr
136+ hPutStrLn stderr (show (f, sec, nsec))
133137 pure (fromEnum sec, fromIntegral nsec)
134138
135139-- Sadly even unix’s getFileStatus + modificationTimeHiRes is still about twice as slow
src/Development/IDE/Core/Rules.hs+4
@@ -25,6 +25,7 @@ module Development.IDE.Core.Rules(
2525 generateCore,
2626 ) where
2727
28+import System.IO
2829import Fingerprint
2930
3031import Data.Binary
@@ -189,6 +190,7 @@ getParsedModuleRule =
189190 (_, contents) <- getFileContents file
190191 packageState <- hscEnv <$> use_ GhcSession file
191192 opt <- getIdeOptions
193+ liftIO $ hPutStrLn stderr "parsing module"
192194 (diag, res) <- liftIO $ parseModule opt packageState (fromNormalizedFilePath file) (fmap textToStringBuffer contents)
193195 case res of
194196 Nothing -> pure (Nothing, (diag, Nothing))
@@ -196,6 +198,7 @@ getParsedModuleRule =
196198 mbFingerprint <- if isNothing $ optShakeFiles opt
197199 then pure Nothing
198200 else liftIO $ Just . fingerprintToBS <$> fingerprintFromStringBuffer contents
201+ liftIO $ hPutStrLn stderr ("fingerprint: " <> show mbFingerprint)
199202 pure (mbFingerprint, (diag, Just modu))
200203
201204getLocatedImportsRule :: Rules ()
@@ -346,6 +349,7 @@ typeCheckRule =
346349 else uses_ TypeCheck (transitiveModuleDeps deps)
347350 setPriority priorityTypeCheck
348351 IdeOptions{ optDefer = defer} <- getIdeOptions
352+ liftIO $ hPutStrLn stderr "typechecking"
349353 liftIO $ typecheckModule defer packageState tms pm
350354 where
351355 uses_th_qq dflags = xopt LangExt.TemplateHaskell dflags || xopt LangExt.QuasiQuotes dflags