@@ -16,7 +16,7 @@ import Idris.Inliner
16import Idris.PartialEval
16import Idris.PartialEval
17import Idris.Transforms
17import Idris.Transforms
18import Idris.DeepSeq
18import Idris.DeepSeq
19−import Idris.Output (iputStrLn, pshow, iWarn, iRenderResult)
19+import Idris.Output (iputStrLn, pshow, iWarn, iRenderResult, sendHighlighting)
20import IRTS.Lang
20import IRTS.Lang
22import Idris.Elab.AsPat
22import Idris.Elab.AsPat
@@ -453,9 +453,10 @@ checkPossible info fc tcgen fname lhs_in
453 -- if the LHS type checks, it is possible
453 -- if the LHS type checks, it is possible
454 case elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
454 case elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
455 (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
455 (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
456− OK (ElabResult lhs' _ _ ctxt' newDecls, _) ->
456+ OK (ElabResult lhs' _ _ ctxt' newDecls highlights, _) ->
457 do setContext ctxt'
457 do setContext ctxt'
458 processTacticDecls info newDecls
458 processTacticDecls info newDecls
459+ sendHighlighting highlights
459 let lhs_tm = orderPats (getInferTerm lhs')
460 let lhs_tm = orderPats (getInferTerm lhs')
460 case recheck ctxt [] (forget lhs_tm) lhs_tm of
461 case recheck ctxt [] (forget lhs_tm) lhs_tm of
461 OK _ -> return True
462 OK _ -> return True
@@ -537,7 +538,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
537 logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show lhs_in ++
538 logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show lhs_in ++
538 "\n" ++ show (fn_ty, fn_is))
539 "\n" ++ show (fn_ty, fn_is))
540− ((ElabResult lhs' dlhs [] ctxt' newDecls, probs, inj), _) <-
541+ ((ElabResult lhs' dlhs [] ctxt' newDecls highlights, probs, inj), _) <-
541 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
542 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
542 (do res <- errAt "left hand side of " fname
543 (do res <- errAt "left hand side of " fname
543 (erun fc (buildTC i info ELHS opts fname (infTerm lhs)))
544 (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
546 return (res, probs, inj))
547 return (res, probs, inj))
547 setContext ctxt'
548 setContext ctxt'
548 processTacticDecls info newDecls
549 processTacticDecls info newDecls
550+ sendHighlighting highlights
549 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
552 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
551 let lhs_tm = orderPats (getInferTerm lhs')
554 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
612 logLvl 2 $ "RHS: " ++ show (map fst newargs_all) ++ " " ++ showTmImpls rhs
615 logLvl 2 $ "RHS: " ++ show (map fst newargs_all) ++ " " ++ showTmImpls rhs
613 ctxt <- getContext -- new context with where block added
616 ctxt <- getContext -- new context with where block added
614 logLvl 5 "STARTING CHECK"
617 logLvl 5 "STARTING CHECK"
615− ((rhs', defer, is, probs, ctxt', newDecls), _) <-
618+ ((rhs', defer, is, probs, ctxt', newDecls, highlights), _) <-
616 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patRHS") clhsty initEState
619 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patRHS") clhsty initEState
617 (do pbinds ist lhs_tm
620 (do pbinds ist lhs_tm
618 mapM_ setinj (nub (params ++ inj))
621 mapM_ setinj (nub (params ++ inj))
619 setNextName
622 setNextName
620− (ElabResult _ _ is ctxt' newDecls) <-
623+ (ElabResult _ _ is ctxt' newDecls highlights) <-
621 errAt "right hand side of " fname
624 errAt "right hand side of " fname
622 (erun fc (build i winfo ERHS opts fname rhs))
625 (erun fc (build i winfo ERHS opts fname rhs))
623 errAt "right hand side of " fname
626 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
629 let (tm, ds) = runState (collectDeferred (Just fname)
632 let (tm, ds) = runState (collectDeferred (Just fname)
630 (map fst $ case_decls aux) ctxt tt) []
633 (map fst $ case_decls aux) ctxt tt) []
631 probs <- get_probs
634 probs <- get_probs
632− return (tm, ds, is, probs, ctxt', newDecls))
635+ return (tm, ds, is, probs, ctxt', newDecls, highlights))
633 setContext ctxt'
636 setContext ctxt'
634 processTacticDecls info newDecls
637 processTacticDecls info newDecls
638+ sendHighlighting highlights
635 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
640 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
637 logLvl 5 "DONE CHECK"
642 logLvl 5 "DONE CHECK"
@@ -774,12 +779,14 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
774 let params = getParamsInType i [] fn_is fn_ty
779 let params = getParamsInType i [] fn_is fn_ty
775 let lhs = stripLinear i $ stripUnmatchable i $ propagateParams i params fn_ty (addImplPat i lhs_in)
780 let lhs = stripLinear i $ stripUnmatchable i $ propagateParams i params fn_ty (addImplPat i lhs_in)
776 logLvl 2 ("LHS: " ++ show lhs)
781 logLvl 2 ("LHS: " ++ show lhs)
777− (ElabResult lhs' dlhs [] ctxt' newDecls, _) <-
782+ (ElabResult lhs' dlhs [] ctxt' newDecls highlights, _) <-
778 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
783 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
779 (errAt "left hand side of with in " fname
784 (errAt "left hand side of with in " fname
780 (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
785 (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
781 setContext ctxt'
786 setContext ctxt'
782 processTacticDecls info newDecls
787 processTacticDecls info newDecls
788+ sendHighlighting highlights
783 let lhs_tm = orderPats (getInferTerm lhs')
790 let lhs_tm = orderPats (getInferTerm lhs')
784 let lhs_ty = getInferType lhs'
791 let lhs_ty = getInferType lhs'
785 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
792 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)
791 let wval = addImplBound i (map fst bargs) wval_in
798 let wval = addImplBound i (map fst bargs) wval_in
792 logLvl 5 ("Checking " ++ showTmImpls wval)
799 logLvl 5 ("Checking " ++ showTmImpls wval)
793 -- Elaborate wval in this context
800 -- Elaborate wval in this context
794− ((wval', defer, is, ctxt', newDecls), _) <-
801+ ((wval', defer, is, ctxt', newDecls, highlights), _) <-
795 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "withRHS")
802 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "withRHS")
796 (bindTyArgs PVTy bargs infP) initEState
803 (bindTyArgs PVTy bargs infP) initEState
797 (do pbinds i lhs_tm
804 (do pbinds i lhs_tm
798 setNextName
805 setNextName
799 -- TODO: may want where here - see winfo abpve
806 -- 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
801 (erun fc (build i info ERHS opts fname (infTerm wval)))
808 (erun fc (build i info ERHS opts fname (infTerm wval)))
802 erun fc $ psolve lhs_tm
809 erun fc $ psolve lhs_tm
803 tt <- get_term
810 tt <- get_term
804− return (tt, d, is, ctxt', newDecls))
811+ return (tt, d, is, ctxt', newDecls, highlights))
805 setContext ctxt'
812 setContext ctxt'
806 processTacticDecls info newDecls
813 processTacticDecls info newDecls
814+ sendHighlighting highlights
807 def' <- checkDef fc iderr defer
816 def' <- checkDef fc iderr defer
808 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
817 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
809 addDeferred def''
818 addDeferred def''
@@ -889,16 +898,18 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
889 logLvl 5 ("New RHS " ++ showTmImpls rhs)
898 logLvl 5 ("New RHS " ++ showTmImpls rhs)
890 ctxt <- getContext -- New context with block added
899 ctxt <- getContext -- New context with block added
891 i <- getIState
900 i <- getIState
892− ((rhs', defer, is, ctxt', newDecls), _) <-
901+ ((rhs', defer, is, ctxt', newDecls, highlights), _) <-
893 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "wpatRHS") clhsty initEState
902 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "wpatRHS") clhsty initEState
894 (do pbinds i lhs_tm
903 (do pbinds i lhs_tm
895 setNextName
904 setNextName
905+ (ElabResult _ d is ctxt' newDecls highlights) <-
896− (ElabResult _ d is ctxt' newDecls) <- erun fc (build i info ERHS opts fname rhs)
906+ erun fc (build i info ERHS opts fname rhs)
897 psolve lhs_tm
907 psolve lhs_tm
898 tt <- get_term
908 tt <- get_term
899− return (tt, d, is, ctxt', newDecls))
909+ return (tt, d, is, ctxt', newDecls, highlights))
900 setContext ctxt'
910 setContext ctxt'
901 processTacticDecls info newDecls
911 processTacticDecls info newDecls
912+ sendHighlighting highlights
903 def' <- checkDef fc iderr defer
914 def' <- checkDef fc iderr defer
904 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
915 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'