@@ -41,7 +41,7 @@ import GHC.Parser.Annotation
4141import Ide.Logger (Recorder , WithPriority ,
4242 cmapWithPrio )
4343import Ide.Plugin.Eval.Types
44-
44+ import Debug.Trace
4545
4646rules :: Recorder (WithPriority Log ) -> Rules ()
4747rules recorder = do
@@ -56,13 +56,13 @@ instance IsIdeGlobal EvaluatingVar
5656queueForEvaluation :: IdeState -> NormalizedFilePath -> IO ()
5757queueForEvaluation ide nfp = do
5858 EvaluatingVar var <- getIdeGlobalState ide
59- atomicModifyIORef' var (\ fs -> (Set. insert nfp fs, () ))
59+ atomicModifyIORef' var (\ fs -> (trace ( " TRACE: queueForEvaluation: " <> show nfp ) $ Set. insert nfp fs, () ))
6060
6161unqueueForEvaluation :: IdeState -> NormalizedFilePath -> IO ()
6262unqueueForEvaluation ide nfp = do
6363 EvaluatingVar var <- getIdeGlobalState ide
6464 -- remove the module from the Evaluating state, so that next time it won't evaluate to True
65- atomicModifyIORef' var $ \ fs -> (Set. delete nfp fs, () )
65+ atomicModifyIORef' var $ \ fs -> (trace ( " TRACE: unqueueForEvaluation: " <> show nfp ) $ Set. delete nfp fs, () )
6666
6767apiAnnComments' :: ParsedModule -> [SrcLoc. RealLocated EpaCommentTok ]
6868apiAnnComments' pm = do
@@ -110,7 +110,7 @@ isEvaluatingRule :: Recorder (WithPriority Log) -> Rules ()
110110isEvaluatingRule recorder = defineEarlyCutoff (cmapWithPrio LogShake recorder) $ RuleNoDiagnostics $ \ IsEvaluating f -> do
111111 alwaysRerun
112112 EvaluatingVar var <- getIdeGlobalAction
113- b <- liftIO $ (f `Set.member` ) <$> readIORef var
113+ b <- fmap (ts2 " isMemberEvaluatingVar " f) . liftIO $ (f `Set.member` ) <$> readIORef var
114114 return (Just (if b then BS. singleton 1 else BS. empty), Just b)
115115
116116-- Redefine the NeedsCompilation rule to set the linkable type to Just _
@@ -120,12 +120,15 @@ isEvaluatingRule recorder = defineEarlyCutoff (cmapWithPrio LogShake recorder) $
120120-- leading to much better performance of the evaluate code lens
121121redefinedNeedsCompilation :: Recorder (WithPriority Log ) -> Rules ()
122122redefinedNeedsCompilation recorder = defineEarlyCutoff (cmapWithPrio LogShake recorder) $ RuleWithCustomNewnessCheck (<=) $ \ NeedsCompilation f -> do
123- isEvaluating <- use_ IsEvaluating f
123+ isEvaluating <- ts2 " isEvaluating " f <$> use_ IsEvaluating f
124124
125125 if not isEvaluating then needsCompilationRule f else do
126126 ms <- msrModSummary . fst <$> useWithStale_ GetModSummaryWithoutTimestamps f
127127 let df' = ms_hspp_opts ms
128128 linkableType = computeLinkableTypeForDynFlags df'
129129 fp = encodeLinkableType $ Just linkableType
130130
131- pure (Just fp, Just (Just linkableType))
131+ pure (Just fp, ts2 " redefinedNeedsCompilation" f $ Just (Just linkableType))
132+
133+ ts2 :: Show a => String -> NormalizedFilePath -> a -> a
134+ ts2 label nfp x = trace (" TRACE: " <> label <> " =" <> show x <> " (" <> show nfp <> " )" ) x
0 commit comments