Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 committed Oct 2, 2020
1 parent 953a5f3 commit 4f28142
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/Development/IDE/Core/OfInterest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ kick = mkDelayedAction "kick" Debug $ do
!exportsMap' = createExportsMap modIfaces
liftIO $ modifyVar_ exportsMap $ evaluate . (exportsMap' <>)

-- Get desugarer warnings
_ <- uses GenerateCore $ HashMap.keys files
-- generate (and write) hie files for queries
_ <- uses GetHieAst $ HashMap.keys files

liftIO $ progressUpdate KickCompleted
37 changes: 21 additions & 16 deletions src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ getHomeHieFile f = do
wait <- lift $ delayedAction $ mkDelayedAction "OutOfDateHie" L.Info $ do
hsc <- hscEnv <$> use_ GhcSession f
pm <- use_ GetParsedModule f
typeCheckRuleDefinition hsc pm
(_, mtm)<- typeCheckRuleDefinition hsc pm
mapM_ (getHieAstRuleDefinition f hsc) mtm
_ <- MaybeT $ liftIO $ timeout 1 wait
ncu <- mkUpdater
liftIO $ loadHieFile ncu hie_f
Expand Down Expand Up @@ -524,21 +525,25 @@ getHieAstsRule =
define $ \GetHieAst f -> do
tmr <- use_ TypeCheck f
hsc <- hscEnv <$> use_ GhcSession f
(diags, masts) <- liftIO $ generateHieAsts hsc tmr

isFoi <- use_ IsFileOfInterest f
diagsWrite <- case isFoi of
IsFOI Modified -> pure []
_ | Just asts <- masts -> do
source <- getSourceFileSource f
liftIO $ writeHieFile hsc (tmrModSummary tmr) (tcg_exports $ tmrTypechecked tmr) asts source
_ -> pure []

im <- use GetLocatedImports f
let mkImports (fileImports, _) = M.fromList $ mapMaybe (\(m, mfp) -> (unLoc m,) . artifactFilePath <$> mfp) fileImports

let refmap = generateReferencesMap . getAsts <$> masts
pure (diags ++ diagsWrite, HAR (ms_mod $ tmrModSummary tmr) <$> masts <*> refmap <*> fmap mkImports im)
getHieAstRuleDefinition f hsc tmr

getHieAstRuleDefinition :: NormalizedFilePath -> HscEnv -> TcModuleResult -> Action (IdeResult HieAstResult)
getHieAstRuleDefinition f hsc tmr = do
(diags, masts) <- liftIO $ generateHieAsts hsc tmr

isFoi <- use_ IsFileOfInterest f
diagsWrite <- case isFoi of
IsFOI Modified -> pure []
_ | Just asts <- masts -> do
source <- getSourceFileSource f
liftIO $ writeHieFile hsc (tmrModSummary tmr) (tcg_exports $ tmrTypechecked tmr) asts source
_ -> pure []

im <- use GetLocatedImports f
let mkImports (fileImports, _) = M.fromList $ mapMaybe (\(m, mfp) -> (unLoc m,) . artifactFilePath <$> mfp) fileImports

let refmap = generateReferencesMap . getAsts <$> masts
pure (diags ++ diagsWrite, HAR (ms_mod $ tmrModSummary tmr) <$> masts <*> refmap <*> fmap mkImports im)

getBindingsRule :: Rules ()
getBindingsRule =
Expand Down

0 comments on commit 4f28142

Please sign in to comment.