@@ -44,6 +44,7 @@ module Development.IDE.Core.Shake(
44
44
define , defineNoDiagnostics ,
45
45
defineEarlyCutoff ,
46
46
defineOnDisk , needOnDisk , needOnDisks ,
47
+ defineNoFile , defineEarlyCutOffNoFile ,
47
48
getDiagnostics ,
48
49
mRunLspT , mRunLspTCallback ,
49
50
getHiddenDiagnostics ,
@@ -833,6 +834,16 @@ defineEarlyCutoff (Rule op) = addRule $ \(Q (key, file)) (old :: Maybe BS.ByteSt
833
834
defineEarlyCutoff (RuleNoDiagnostics op) = addRule $ \ (Q (key, file)) (old :: Maybe BS. ByteString ) mode -> otTracedAction key file isSuccess $ do
834
835
defineEarlyCutoff' False key file old mode $ second (mempty ,) <$> op key file
835
836
837
+ defineNoFile :: IdeRule k v => (k -> Action v ) -> Rules ()
838
+ defineNoFile f = defineNoDiagnostics $ \ k file -> do
839
+ if file == emptyFilePath then do res <- f k; return (Just res) else
840
+ fail $ " Rule " ++ show k ++ " should always be called with the empty string for a file"
841
+
842
+ defineEarlyCutOffNoFile :: IdeRule k v => (k -> Action (BS. ByteString , v )) -> Rules ()
843
+ defineEarlyCutOffNoFile f = defineEarlyCutoff $ RuleNoDiagnostics $ \ k file -> do
844
+ if file == emptyFilePath then do (hash, res) <- f k; return (Just hash, Just res) else
845
+ fail $ " Rule " ++ show k ++ " should always be called with the empty string for a file"
846
+
836
847
defineEarlyCutoff'
837
848
:: IdeRule k v
838
849
=> Bool -- ^ update diagnostics
0 commit comments