Skip to content

Commit

Permalink
comment out the persisting code until I can fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWhiting committed Nov 4, 2023
1 parent de64d0a commit 079df67
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions src/LanguageServer/Handler/TextDocument.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,28 +146,30 @@ persistModules = do

persistModule :: Module -> LSM ()
persistModule m = do
let generate = do
-- trace "Generating" $ return ()
mld <- getLoaded
case mld of
Just loaded -> do
term <- getTerminal
flags <- getFlags
(loaded, file) <- liftIO $ codeGen term flags Object loaded{loadedModule = m}
putLoaded loaded
return ()
Nothing -> return ()
-- trace ("Module " ++ show (modName m)) $
case modOutputTime m of
Nothing -> do
-- trace "No output time" $ return ()
generate
-- If it has been 5 seconds since the last time the module was changed
-- and it isn't updated on disk persist again.
-- We don't do it all the time, because with virtual files and editor changes it would be too much
Just t -> do
ct <- liftIO getCurrentTime
when ((ct > addUTCTime 5 (modTime m)) && (modTime m > t)) $ do
-- trace ("Last output time" ++ show t) $ return ()
generate
return ()
return ()
-- TODO: This works, but needs to check that the dependencies are persisted first.
-- let generate = do
-- -- trace "Generating" $ return ()
-- mld <- getLoaded
-- case mld of
-- Just loaded -> do
-- term <- getTerminal
-- flags <- getFlags
-- (loaded, file) <- liftIO $ codeGen term flags Object loaded{loadedModule = m}
-- putLoaded loaded
-- return ()
-- Nothing -> return ()
-- -- trace ("Module " ++ show (modName m)) $
-- case modOutputTime m of
-- Nothing -> do
-- -- trace "No output time" $ return ()
-- generate
-- -- If it has been 5 seconds since the last time the module was changed
-- -- and it isn't updated on disk persist again.
-- -- We don't do it all the time, because with virtual files and editor changes it would be too much
-- Just t -> do
-- ct <- liftIO getCurrentTime
-- when ((ct > addUTCTime 5 (modTime m)) && (modTime m > t)) $ do
-- -- trace ("Last output time" ++ show t) $ return ()
-- generate
-- return ()

0 comments on commit 079df67

Please sign in to comment.