on master help sign in
Preserve manual name type annotations

This lets highlighting code override the global state highlighting, for example when emitting highlight information for something that's not yet in the global state.

commit840f5886f3b8da80fc04618bbaa6f09b46a8d5ba authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateThu 18 Jun 2015, 20:12 (11 years ago) parent5f9f8b1
1 file changed+8−7
src/Idris/Delaborate.hs+8−7
src/Idris/Delaborate.hs+8−7
@@ -19,6 +19,7 @@ import Data.Generics.Uniplate.Data (transform)
1919import Data.Maybe (mapMaybe)
2020import Data.List (intersperse, nub)
2121import qualified Data.Text as T
22+import Control.Applicative (Alternative((<|>)))
2223import Control.Monad.State
2324
2425import Debug.Trace
@@ -566,18 +567,18 @@ annTm tm = annotate (AnnTerm [] tm)
566567
567568-- | Add extra metadata to an output annotation, optionally marking metavariables.
568569fancifyAnnots :: IState -> Bool -> OutputAnnotation -> OutputAnnotation
569−fancifyAnnots ist meta annot@(AnnName n _ _ _) =
570+fancifyAnnots ist meta annot@(AnnName n nt _ _) =
570571 do let ctxt = tt_ctxt ist
571572 docs = docOverview ist n
572573 ty = Just (getTy ist n)
573574 case () of
574− _ | isDConName n ctxt -> AnnName n (Just DataOutput) docs ty
575− _ | isFnName n ctxt -> AnnName n (Just FunOutput) docs ty
576− _ | isTConName n ctxt -> AnnName n (Just TypeOutput) docs ty
575+ _ | isDConName n ctxt -> AnnName n (nt <|> Just DataOutput) docs ty
576+ _ | isFnName n ctxt -> AnnName n (nt <|> Just FunOutput) docs ty
577+ _ | isTConName n ctxt -> AnnName n (nt <|> Just TypeOutput) docs ty
577578 _ | isMetavarName n ist -> if meta
578− then AnnName n (Just MetavarOutput) docs ty
579− else AnnName n (Just FunOutput) docs ty
580− _ | isPostulateName n ist -> AnnName n (Just PostulateOutput) docs ty
579+ then AnnName n (nt <|> Just MetavarOutput) docs ty
580+ else AnnName n (nt <|> Just FunOutput) docs ty
581+ _ | isPostulateName n ist -> AnnName n (nt <|> Just PostulateOutput) docs ty
581582 _ | otherwise -> annot
582583 where docOverview :: IState -> Name -> Maybe String -- pretty-print first paragraph of docs
583584 docOverview ist n = do docs <- lookupCtxtExact n (idris_docstrings ist)