@@ -9,14 +9,16 @@ import qualified Data.Map.Strict as Map
9
9
import Data.String (fromString )
10
10
import Development.IDE (GetModSummaryWithoutTimestamps (GetModSummaryWithoutTimestamps ),
11
11
GetParsedModuleWithComments (GetParsedModuleWithComments ),
12
+ IsFileOfInterest (IsFileOfInterest ),
13
+ IsFileOfInterestResult (NotFOI ),
12
14
NeedsCompilation (NeedsCompilation ),
13
15
RuleBody (RuleNoDiagnostics ),
14
16
Rules , defineEarlyCutoff ,
15
17
encodeLinkableType ,
16
18
fromNormalizedFilePath ,
17
19
msrModSummary ,
18
20
realSrcSpanToRange ,
19
- useWithStale_ )
21
+ useWithStale_ , use_ )
20
22
import Development.IDE.Core.PositionMapping (toCurrentRange )
21
23
import Development.IDE.Core.Rules (computeLinkableType ,
22
24
needsCompilationRule )
@@ -73,13 +75,15 @@ evalParsedModuleRule = defineEarlyCutoff $ RuleNoDiagnostics $ \GetEvalComments
73
75
return (Just fingerPrint, Just comments)
74
76
75
77
-- Redefine the NeedsCompilation rule to set the linkable type to Just _
76
- -- whenever the module has Eval comments. This will ensure that the modules
77
- -- are loaded with linkables and the interactive session won't try to compile
78
- -- them on the fly, leading to much better performance of the evaluate code lens
78
+ -- whenever the module has Eval comments and is of interest.
79
+ -- This will ensure that the modules are loaded with linkables
80
+ -- and the interactive session won't try to compile them on the fly,
81
+ -- leading to much better performance of the evaluate code lens
79
82
redefinedNeedsCompilation :: Rules ()
80
83
redefinedNeedsCompilation = defineEarlyCutoff $ RuleNoDiagnostics $ \ NeedsCompilation f -> do
81
84
(comments, _) <- useWithStale_ GetEvalComments f
82
- if nullComments comments then needsCompilationRule f else do
85
+ isFOI <- use_ IsFileOfInterest f
86
+ if nullComments comments || isFOI == NotFOI then needsCompilationRule f else do
83
87
ms <- msrModSummary . fst <$> useWithStale_ GetModSummaryWithoutTimestamps f
84
88
let ms' = ms{ms_hspp_opts = df'}
85
89
df' = xopt_set (ms_hspp_opts ms) LangExt. TemplateHaskell
0 commit comments