@@ -924,19 +924,20 @@ defineEarlyCutoff
924924 => RuleBody k v
925925 -> Rules ()
926926defineEarlyCutoff (Rule op) = addBuiltinRule noLint noIdentity $ \ (Q (key, file)) (old :: Maybe BS. ByteString ) mode -> otTracedAction key file isSuccess $ do
927- defineEarlyCutoff' key file old mode $ op key file
927+ defineEarlyCutoff' True key file old mode $ op key file
928928defineEarlyCutoff (RuleNoDiagnostics op) = addBuiltinRule noLint noIdentity $ \ (Q (key, file)) (old :: Maybe BS. ByteString ) mode -> otTracedAction key file isSuccess $ do
929- defineEarlyCutoff' key file old mode $ second (mempty ,) <$> op key file
929+ defineEarlyCutoff' False key file old mode $ second (mempty ,) <$> op key file
930930
931931defineEarlyCutoff'
932932 :: IdeRule k v
933- => k
933+ => Bool -- ^ update diagnostics
934+ -> k
934935 -> NormalizedFilePath
935936 -> Maybe BS. ByteString
936937 -> RunMode
937938 -> Action (Maybe BS. ByteString , IdeResult v )
938939 -> Action (RunResult (A (RuleResult k )))
939- defineEarlyCutoff' key file old mode action = do
940+ defineEarlyCutoff' doDiagnostics key file old mode action = do
940941 extras@ ShakeExtras {state, inProgress} <- getShakeExtras
941942 -- don't do progress for GetFileExists, as there are lots of non-nodes for just that one key
942943 (if show key == " GetFileExists" then id else withProgressVar inProgress file) $ do
@@ -947,7 +948,8 @@ defineEarlyCutoff' key file old mode action = do
947948 -- No changes in the dependencies and we have
948949 -- an existing result.
949950 Just (v, diags) -> do
950- updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) $ Vector. toList diags
951+ when doDiagnostics $
952+ updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) $ Vector. toList diags
951953 return $ Just $ RunResult ChangedNothing old $ A v
952954 _ -> return Nothing
953955 _ -> return Nothing
@@ -972,7 +974,8 @@ defineEarlyCutoff' key file old mode action = do
972974 (toShakeValue ShakeResult bs, Failed b)
973975 Just v -> pure (maybe ShakeNoCutoff ShakeResult bs, Succeeded (vfsVersion =<< modTime) v)
974976 liftIO $ setValues state key file res (Vector. fromList diags)
975- updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) diags
977+ when doDiagnostics $
978+ updateFileDiagnostics file (Key key) extras $ map (\ (_,y,z) -> (y,z)) diags
976979 let eq = case (bs, fmap decodeShakeValue old) of
977980 (ShakeResult a, Just (ShakeResult b)) -> a == b
978981 (ShakeStale a, Just (ShakeStale b)) -> a == b
0 commit comments