Fixes problem where when compiling using "load-file" in ide mode causes compilation to run slower and slower each time. (#2136)

This commit is contained in:
Tim Engler 2022-02-21 20:11:37 +08:00 committed by GitHub
parent 4ba3bb6670
commit 8ffad8878f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,10 +140,19 @@ process : {auto c : Ref Ctxt Defs} ->
process (Interpret cmd)
= replWrap $ interpret cmd
process (LoadFile fname_in _)
= do let fname = case !(findIpkg (Just fname_in)) of
= do
defs <- get Ctxt
let extraDirs = defs.options.dirs.extra_dirs
let fname = case !(findIpkg (Just fname_in)) of
Nothing => fname_in
Just f' => f'
replWrap $ Idris.REPL.process (Load fname) >>= outputSyntaxHighlighting fname
res <- replWrap $ Idris.REPL.process (Load fname) >>= outputSyntaxHighlighting fname
--findIpkg keeps adding extra dirs everytime its run, so we need to reset
--it back to what it was
defs <- get Ctxt
put Ctxt ({ options->dirs->extra_dirs := extraDirs } defs)
pure res
process (NameAt name Nothing)
= do defs <- get Ctxt
glob <- lookupCtxtName (UN (mkUserName name)) (gamma defs)