@@ -16,7 +16,7 @@ import Idris.Inliner
1616import Idris.PartialEval
1717import Idris.Transforms
1818import Idris.DeepSeq
19−import Idris.Output (iputStrLn, pshow, iWarn, iRenderResult)
19+import Idris.Output (iputStrLn, pshow, iWarn, iRenderResult, sendHighlighting)
2020import IRTS.Lang
2121
2222import Idris.Elab.AsPat
@@ -453,9 +453,10 @@ checkPossible info fc tcgen fname lhs_in
453453 -- if the LHS type checks, it is possible
454454 case elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
455455 (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
456− OK (ElabResult lhs' _ _ ctxt' newDecls, _) ->
456+ OK (ElabResult lhs' _ _ ctxt' newDecls highlights, _) ->
457457 do setContext ctxt'
458458 processTacticDecls info newDecls
459+ sendHighlighting highlights
459460 let lhs_tm = orderPats (getInferTerm lhs')
460461 case recheck ctxt [] (forget lhs_tm) lhs_tm of
461462 OK _ -> return True
@@ -537,7 +538,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
537538 logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show lhs_in ++
538539 "\n" ++ show (fn_ty, fn_is))
539540
540− ((ElabResult lhs' dlhs [] ctxt' newDecls, probs, inj), _) <-
541+ ((ElabResult lhs' dlhs [] ctxt' newDecls highlights, probs, inj), _) <-
541542 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
542543 (do res <- errAt "left hand side of " fname
543544 (erun fc (buildTC i info ELHS opts fname (infTerm lhs)))
@@ -546,6 +547,8 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
546547 return (res, probs, inj))
547548 setContext ctxt'
548549 processTacticDecls info newDecls
550+ sendHighlighting highlights
551+
549552 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
550553
551554 let lhs_tm = orderPats (getInferTerm lhs')
@@ -612,12 +615,12 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
612615 logLvl 2 $ "RHS: " ++ show (map fst newargs_all) ++ " " ++ showTmImpls rhs
613616 ctxt <- getContext -- new context with where block added
614617 logLvl 5 "STARTING CHECK"
615− ((rhs', defer, is, probs, ctxt', newDecls), _) <-
618+ ((rhs', defer, is, probs, ctxt', newDecls, highlights), _) <-
616619 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patRHS") clhsty initEState
617620 (do pbinds ist lhs_tm
618621 mapM_ setinj (nub (params ++ inj))
619622 setNextName
620− (ElabResult _ _ is ctxt' newDecls) <-
623+ (ElabResult _ _ is ctxt' newDecls highlights) <-
621624 errAt "right hand side of " fname
622625 (erun fc (build i winfo ERHS opts fname rhs))
623626 errAt "right hand side of " fname
@@ -629,9 +632,11 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
629632 let (tm, ds) = runState (collectDeferred (Just fname)
630633 (map fst $ case_decls aux) ctxt tt) []
631634 probs <- get_probs
632− return (tm, ds, is, probs, ctxt', newDecls))
635+ return (tm, ds, is, probs, ctxt', newDecls, highlights))
633636 setContext ctxt'
634637 processTacticDecls info newDecls
638+ sendHighlighting highlights
639+
635640 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
636641
637642 logLvl 5 "DONE CHECK"
@@ -774,12 +779,14 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
774779 let params = getParamsInType i [] fn_is fn_ty
775780 let lhs = stripLinear i $ stripUnmatchable i $ propagateParams i params fn_ty (addImplPat i lhs_in)
776781 logLvl 2 ("LHS: " ++ show lhs)
777− (ElabResult lhs' dlhs [] ctxt' newDecls, _) <-
782+ (ElabResult lhs' dlhs [] ctxt' newDecls highlights, _) <-
778783 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
779784 (errAt "left hand side of with in " fname
780785 (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
781786 setContext ctxt'
782787 processTacticDecls info newDecls
788+ sendHighlighting highlights
789+
783790 let lhs_tm = orderPats (getInferTerm lhs')
784791 let lhs_ty = getInferType lhs'
785792 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
@@ -791,19 +798,21 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
791798 let wval = addImplBound i (map fst bargs) wval_in
792799 logLvl 5 ("Checking " ++ showTmImpls wval)
793800 -- Elaborate wval in this context
794− ((wval', defer, is, ctxt', newDecls), _) <-
801+ ((wval', defer, is, ctxt', newDecls, highlights), _) <-
795802 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "withRHS")
796803 (bindTyArgs PVTy bargs infP) initEState
797804 (do pbinds i lhs_tm
798805 setNextName
799806 -- TODO: may want where here - see winfo abpve
800− (ElabResult _ d is ctxt' newDecls) <- errAt "with value in " fname
807+ (ElabResult _ d is ctxt' newDecls highlights) <- errAt "with value in " fname
801808 (erun fc (build i info ERHS opts fname (infTerm wval)))
802809 erun fc $ psolve lhs_tm
803810 tt <- get_term
804− return (tt, d, is, ctxt', newDecls))
811+ return (tt, d, is, ctxt', newDecls, highlights))
805812 setContext ctxt'
806813 processTacticDecls info newDecls
814+ sendHighlighting highlights
815+
807816 def' <- checkDef fc iderr defer
808817 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
809818 addDeferred def''
@@ -889,16 +898,18 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
889898 logLvl 5 ("New RHS " ++ showTmImpls rhs)
890899 ctxt <- getContext -- New context with block added
891900 i <- getIState
892− ((rhs', defer, is, ctxt', newDecls), _) <-
901+ ((rhs', defer, is, ctxt', newDecls, highlights), _) <-
893902 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "wpatRHS") clhsty initEState
894903 (do pbinds i lhs_tm
895904 setNextName
896− (ElabResult _ d is ctxt' newDecls) <- erun fc (build i info ERHS opts fname rhs)
905+ (ElabResult _ d is ctxt' newDecls highlights) <-
906+ erun fc (build i info ERHS opts fname rhs)
897907 psolve lhs_tm
898908 tt <- get_term
899− return (tt, d, is, ctxt', newDecls))
909+ return (tt, d, is, ctxt', newDecls, highlights))
900910 setContext ctxt'
901911 processTacticDecls info newDecls
912+ sendHighlighting highlights
902913
903914 def' <- checkDef fc iderr defer
904915 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'