Module docstring
{"# Additions to the delaborator "}
{"# Additions to the delaborator "}
Lean.PrettyPrinter.Delaborator.withBindingBodyUnusedName'
definition
{α} (d : Syntax → Expr → DelabM α) : DelabM α
/-- Assuming the current expression in a lambda or pi,
descend into the body using an unused name generated from the binder's name.
Provides `d` with both `Syntax` for the bound name as an identifier
as well as the fresh fvar for the bound variable.
See also `Lean.PrettyPrinter.Delaborator.withBindingBodyUnusedName`. -/
def withBindingBodyUnusedName' {α} (d : Syntax → Expr → DelabM α) : DelabM α := do
let n ← getUnusedName (← getExpr).bindingName! (← getExpr).bindingBody!
withBindingBody' n (fun fvar => return (← mkAnnotatedIdent n fvar, fvar))
(fun (stxN, fvar) => d stxN fvar)
Lean.PrettyPrinter.Delaborator.OptionsPerPos.setBool
definition
(opts : OptionsPerPos) (p : SubExpr.Pos) (n : Name) (v : Bool) : OptionsPerPos
/-- Update `OptionsPerPos` at the given position, setting the key `n`
to have the boolean value `v`. -/
def OptionsPerPos.setBool (opts : OptionsPerPos) (p : SubExpr.Pos) (n : Name) (v : Bool) :
OptionsPerPos :=
let e := opts.findD p {} |>.setBool n v
opts.insert p e
Lean.PrettyPrinter.Delaborator.annotateGoToDef
definition
(stx : Term) (target : Name) : DelabM Term
/-- Annotates `stx` with the go-to-def information of `target`. -/
def annotateGoToDef (stx : Term) (target : Name) : DelabM Term := do
let module := (← findModuleOf? target).getD (← getEnv).mainModule
let some range ← findDeclarationRanges? target | return stx
let stx ← annotateCurPos stx
let location := { module, range := range.selectionRange }
addDelabTermInfoaddDelabTermInfo (← getPos) stx (← getExpr) (location? := some location)
return stx
Lean.PrettyPrinter.Delaborator.annotateGoToSyntaxDef
definition
(stx : Term) : DelabM Term
/-- Annotates `stx` with the go-to-def information of the notation used in `stx`. -/
def annotateGoToSyntaxDef (stx : Term) : DelabM Term := do
annotateGoToDef stx stx.raw.getKind