Skip to content

Commit 4118111

Browse files
committed
restrict to FOIs
1 parent 44e8817 commit 4118111

File tree

1 file changed

+9
-5
lines changed
  • plugins/hls-eval-plugin/src/Ide/Plugin/Eval

1 file changed

+9
-5
lines changed

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ import qualified Data.Map.Strict as Map
99
import Data.String (fromString)
1010
import Development.IDE (GetModSummaryWithoutTimestamps (GetModSummaryWithoutTimestamps),
1111
GetParsedModuleWithComments (GetParsedModuleWithComments),
12+
IsFileOfInterest (IsFileOfInterest),
13+
IsFileOfInterestResult (NotFOI),
1214
NeedsCompilation (NeedsCompilation),
1315
RuleBody (RuleNoDiagnostics),
1416
Rules, defineEarlyCutoff,
1517
encodeLinkableType,
1618
fromNormalizedFilePath,
1719
msrModSummary,
1820
realSrcSpanToRange,
19-
useWithStale_)
21+
useWithStale_, use_)
2022
import Development.IDE.Core.PositionMapping (toCurrentRange)
2123
import Development.IDE.Core.Rules (computeLinkableType,
2224
needsCompilationRule)
@@ -73,13 +75,15 @@ evalParsedModuleRule = defineEarlyCutoff $ RuleNoDiagnostics $ \GetEvalComments
7375
return (Just fingerPrint, Just comments)
7476

7577
-- 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
7982
redefinedNeedsCompilation :: Rules ()
8083
redefinedNeedsCompilation = defineEarlyCutoff $ RuleNoDiagnostics $ \NeedsCompilation f -> do
8184
(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
8387
ms <- msrModSummary . fst <$> useWithStale_ GetModSummaryWithoutTimestamps f
8488
let ms' = ms{ms_hspp_opts = df'}
8589
df' = xopt_set (ms_hspp_opts ms) LangExt.TemplateHaskell

0 commit comments

Comments
 (0)