@@ -15,7 +15,7 @@ import Idris.Primitives
1515import Idris.Inliner
1616import Idris.PartialEval
1717import Idris.DeepSeq
18−import Idris.Output (iputStrLn, pshow, iWarn)
18+import Idris.Output (iputStrLn, pshow, iWarn, sendHighlighting)
1919import IRTS.Lang
2020
2121import Idris.Elab.Type
@@ -51,7 +51,7 @@ import Data.List.Split (splitOn)
5151import Util.Pretty(pretty, text)
5252
5353elabData :: ElabInfo -> SyntaxInfo -> Docstring (Either Err PTerm)-> [(Name, Docstring (Either Err PTerm))] -> FC -> DataOpts -> PData -> Idris ()
54−elabData info syn doc argDocs fc opts (PLaterdecl n t_in)
54+elabData info syn doc argDocs fc opts (PLaterdecl n nfc t_in)
5555 = do let codata = Codata `elem` opts
5656 iLOG (show (fc, doc))
5757 checkUndefined fc n
@@ -59,8 +59,9 @@ elabData info syn doc argDocs fc opts (PLaterdecl n t_in)
5959
6060 addIBC (IBCDef n)
6161 updateContext (addTyDecl n (TCon 0 0) cty) -- temporary, to check cons
62+ sendHighlighting [(nfc, AnnName n Nothing Nothing Nothing)]
6263
63−elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
64+elabData info syn doc argDocs fc opts (PDatadecl n nfc t_in dcons)
6465 = do let codata = Codata `elem` opts
6566 iLOG (show fc)
6667 undef <- isUndefined fc n
@@ -116,6 +117,11 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
116117 -- create a case function
117118 when (DefaultCaseFun `elem` opts) $
118119 evalStateT (elabCaseFun False params n t dcons info) Map.empty
120+ -- Emit highlighting info
121+ sendHighlighting $ [(nfc, AnnName n Nothing Nothing Nothing)] ++
122+ map (\(_, _, n, nfc, _, _, _) ->
123+ (nfc, AnnName n Nothing Nothing Nothing))
124+ dcons
119125 where
120126 setDetaggable :: Name -> Idris ()
121127 setDetaggable n = do
@@ -194,7 +200,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
194200 | otherwise = count n ts
195201 mParam args (_ : rest) = Nothing : mParam args rest
196202
197− cname (_, _, n, _, _, _) = n
203+ cname (_, _, n, _, _, _, _) = n
198204
199205 -- Abuse of ElabInfo.
200206 -- TODO Contemplate whether the ElabInfo type needs modification.
@@ -212,9 +218,9 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
212218elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
213219 Type -> -- for unique kind checking
214220 Type -> -- data type's kind
215− (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, PTerm, FC, [Name]) ->
221+ (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name]) ->
216222 Idris (Name, Type)
217−elabCon info syn tn codata expkind dkind (doc, argDocs, n, t_in, fc, forcenames)
223+elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcenames)
218224 = do checkUndefined fc n
219225 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t_in
220226 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
@@ -302,17 +308,17 @@ type EliminatorState = StateT (Map.Map String Int) Idris
302308-- FIXME: Many things have name starting with elim internally since this was the only purpose in the first edition of the function
303309-- rename to caseFun to match updated intend
304310elabCaseFun :: Bool -> [Int] -> Name -> PTerm ->
305− [(Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, PTerm, FC, [Name])] ->
311+ [(Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name])] ->
306312 ElabInfo -> EliminatorState ()
307313elabCaseFun ind paramPos n ty cons info = do
308314 elimLog $ "Elaborating case function"
309− put (Map.fromList $ zip (concatMap (\(_, p, _, ty, _, _) -> (map show $ boundNamesIn ty) ++ map (show . fst) p) cons ++ (map show $ boundNamesIn ty)) (repeat 0))
315+ put (Map.fromList $ zip (concatMap (\(_, p, _, _, ty, _, _) -> (map show $ boundNamesIn ty) ++ map (show . fst) p) cons ++ (map show $ boundNamesIn ty)) (repeat 0))
310316 let (cnstrs, _) = splitPi ty
311317 let (splittedTy@(pms, idxs)) = splitPms cnstrs
312318 generalParams <- namePis False pms
313319 motiveIdxs <- namePis False idxs
314320 let motive = mkMotive n paramPos generalParams motiveIdxs
315− consTerms <- mapM (\(c@(_, _, cnm, _, _, _)) -> do
321+ consTerms <- mapM (\(c@(_, _, cnm, _, _, _, _)) -> do
316322 let casefunt = if ind then "elim_" else "case_"
317323 name <- freshName $ casefunt ++ simpleName cnm
318324 consTerm <- extractConsTerm c generalParams
@@ -488,8 +494,8 @@ elabCaseFun ind paramPos n ty cons info = do
488494 in return $ filter (\(n,_,_) -> not (n `elem` oldParams))implargs
489495 _ -> return implargs
490496
491− extractConsTerm :: (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, PTerm, FC, [Name]) -> [(Name, Plicity, PTerm)] -> EliminatorState PTerm
492− extractConsTerm (doc, argDocs, cnm, ty, fc, fs) generalParameters = do
497+ extractConsTerm :: (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name]) -> [(Name, Plicity, PTerm)] -> EliminatorState PTerm
498+ extractConsTerm (doc, argDocs, cnm, _, ty, fc, fs) generalParameters = do
493499 let cons' = replaceParams paramPos generalParameters ty
494500 let (args, resTy) = splitPi cons'
495501 implidxs <- implicitIndexes (doc, cnm, ty, fc, fs)
@@ -524,8 +530,8 @@ elabCaseFun ind paramPos n ty cons info = do
524530 convertImplPi (PImp {getTm = t, pname = n}) = Just (n, expl, t)
525531 convertImplPi _ = Nothing
526532
527− generateEliminatorClauses :: (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, PTerm, FC, [Name]) -> Name -> [PArg] -> [(Name, Plicity, PTerm)] -> EliminatorState PClause
528− generateEliminatorClauses (doc, _, cnm, ty, fc, fs) cnsElim generalArgs generalParameters = do
533+ generateEliminatorClauses :: (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name]) -> Name -> [PArg] -> [(Name, Plicity, PTerm)] -> EliminatorState PClause
534+ generateEliminatorClauses (doc, _, cnm, _, ty, fc, fs) cnsElim generalArgs generalParameters = do
529535 let cons' = replaceParams paramPos generalParameters ty
530536 let (args, resTy) = splitPi cons'
531537 i <- State.lift getIState