filled in typeDeclHeader, in theory this has no remaining todos end-to-end

This commit is contained in:
Paul Chiusano 2021-07-13 11:39:14 -04:00
parent b1bf9943e7
commit 27c383a6f5

View File

@ -86,6 +86,7 @@ import qualified Unison.Util.SyntaxText as SyntaxText
import Unison.Var (Var)
import qualified Unison.Server.Doc as Doc
import qualified Unison.UnisonFile as UF
import qualified Unison.Codebase.Editor.DisplayObject as DisplayObject
data ShallowListEntry v a
= ShallowTermEntry (TermEntry v a)
@ -267,12 +268,18 @@ typeDeclHeader
-> PPE.PrettyPrintEnv
-> Reference
-> Backend m (DisplayObject Syntax.SyntaxText)
typeDeclHeader code ppe r = undefined code r ppe "todo"
-- prettyDeclOrBuiltinHeader
-- :: Var v
-- => HashQualified Name
-- -> DD.DeclOrBuiltin v a
-- -> Pretty SyntaxText
typeDeclHeader code ppe r = case Reference.toId r of
Just rid ->
(lift $ Codebase.getTypeDeclaration code rid) <&> \case
Nothing -> DisplayObject.MissingObject (Reference.toShortHash r)
Just decl ->
DisplayObject.UserObject pretty
where
name = PPE.typeName ppe r
pretty = Syntax.convertElement <$>
Pretty.render defaultWidth (DeclPrinter.prettyDeclHeader name decl)
Nothing ->
pure DisplayObject.BuiltinObject
termEntryToNamedTerm
:: Var v => PPE.PrettyPrintEnv -> Maybe Width -> TermEntry v a -> NamedTerm