Elaborator information with elaborator context.
It can be thought of as a "thunked" elaboration computation that allows us
to retroactively extract type information, symbol locations, etc.
through arbitrary invocations of runMetaM
(where the necessary context and state
can be reconstructed from ctx
and info.lctx
).
W.r.t. widgets, this is used to tag different parts of expressions in ppExprTagged
.
This is the input to the RPC call Lean.Widget.InteractiveDiagnostics.infoToInteractive
.
It carries over information about delaborated
Info
nodes in a CodeWithInfos
, and the associated pretty-printing
functionality is purpose-specific to showing the contents of infoview popups.
For use in standard LSP go-to-definition (see Lean.Server.FileWorker.locationLinksOfInfo
),
all the elaborator information we need for similar tasks is already fully recoverable via
the InfoTree
structure (see Lean.Elab.InfoTree.visitM
).
There we use this as a convenience wrapper for queried nodes (e.g. the return value of
Lean.Elab.InfoTree.hoverableInfoAt?
). It also includes the children info nodes
as additional context (this is unused in the RPC case, as delaboration has no notion of child nodes).
NOTE: This type is for internal use in the infoview/LSP. It should not be used in user widgets.
- ctx : Lean.Elab.ContextInfo
- info : Lean.Elab.Info
- children : Lean.PersistentArray Lean.Elab.InfoTree
Instances For
Visit nodes, passing in a surrounding context (the innermost one combined with all outer ones) and
accumulating results on the way back up. If preNode
returns false
, the children of the current
node are skipped and postNode
is invoked with an empty list of results.
Equations
- Lean.Elab.InfoTree.visitM preNode postNode ctx? = Lean.Elab.InfoTree.visitM.go preNode postNode ctx?
Instances For
InfoTree.visitM
specialized to Unit
return type
Equations
- One or more equations did not get rendered due to their size.
Instances For
Visit nodes bottom-up, passing in a surrounding context (the innermost one) and the union of nested results (empty at leaves).
Equations
- One or more equations did not get rendered due to their size.
Instances For
For every branch of the InfoTree
, find the deepest node in that branch for which p
returns
some _
and return the union of all such nodes. The visitor p
is given a node together with
its innermost surrounding ContextInfo
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Elab.InfoTree.foldInfo f init = Lean.Elab.InfoTree.foldInfo.go f none init
Instances For
Fold an info tree as follows, while ensuring that the correct ContextInfo
is supplied at each stage:
- Nodes are combined with the initial value
init
usingf
, and the result is then combined with the children using a left fold - On InfoTree holes, we just return the initial value.
This is like InfoTree.foldInfo
, but it also passes the whole node to f
instead of just the head.
Equations
- Lean.Elab.InfoTree.foldInfoTree init f = Lean.Elab.InfoTree.foldInfoTree.go f none init
Instances For
foldInfoTree.go
is like foldInfoTree
but with an additional outer context parameter ctx?
.
Equations
- (Lean.Elab.Info.ofTermInfo i).isTerm = true
- x.isTerm = false
Instances For
Equations
- (Lean.Elab.Info.ofCompletionInfo i).isCompletion = true
- x.isCompletion = false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- (Lean.Elab.Info.ofTacticInfo i).stx = i.stx
- (Lean.Elab.Info.ofTermInfo i).stx = i.stx
- (Lean.Elab.Info.ofCommandInfo i).stx = i.stx
- (Lean.Elab.Info.ofMacroExpansionInfo i).stx = i.stx
- (Lean.Elab.Info.ofOptionInfo i).stx = i.stx
- (Lean.Elab.Info.ofFieldInfo i).stx = i.stx
- (Lean.Elab.Info.ofCompletionInfo i).stx = i.stx
- (Lean.Elab.Info.ofCustomInfo i).stx = i.stx
- (Lean.Elab.Info.ofUserWidgetInfo i).stx = i.stx
- (Lean.Elab.Info.ofFVarAliasInfo i).stx = Lean.Syntax.missing
- (Lean.Elab.Info.ofFieldRedeclInfo i).stx = i.stx
- (Lean.Elab.Info.ofOmissionInfo i).stx = i.stx
Instances For
Equations
- (Lean.Elab.Info.ofTermInfo i).lctx = i.lctx
- (Lean.Elab.Info.ofFieldInfo i).lctx = i.lctx
- (Lean.Elab.Info.ofOmissionInfo i).lctx = i.lctx
- (Lean.Elab.Info.ofMacroExpansionInfo i).lctx = i.lctx
- (Lean.Elab.Info.ofCompletionInfo i).lctx = i.lctx
- x.lctx = Lean.LocalContext.empty
Instances For
Instances For
Instances For
Instances For
Equations
- i.contains pos includeStop = Option.any (fun (x : String.Range) => x.contains pos includeStop) i.range?
Instances For
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find an info node, if any, which should be shown on hover/cursor at position hoverPos
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- (Lean.Elab.Info.ofTermInfo ti).type? = do let a ← Lean.Meta.inferType ti.expr pure (some a)
- (Lean.Elab.Info.ofFieldInfo fi).type? = do let a ← Lean.Meta.inferType fi.val pure (some a)
- (Lean.Elab.Info.ofOmissionInfo oi).type? = do let a ← Lean.Meta.inferType oi.expr pure (some a)
- i.type? = pure none
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a hover popup, if any, from an info node in a context.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.Elab.Info.fmtHover?.fmtTermAndModule? i = pure (none, none)
Instances For
Equations
- Lean.Elab.Info.fmtHover?.isAtomicFormat (Std.Format.text a) = true
- Lean.Elab.Info.fmtHover?.isAtomicFormat (f.group behavior) = Lean.Elab.Info.fmtHover?.isAtomicFormat f
- Lean.Elab.Info.fmtHover?.isAtomicFormat (Lean.Format.nest indent f) = Lean.Elab.Info.fmtHover?.isAtomicFormat f
- Lean.Elab.Info.fmtHover?.isAtomicFormat (Lean.Format.tag a f) = Lean.Elab.Info.fmtHover?.isAtomicFormat f
- Lean.Elab.Info.fmtHover?.isAtomicFormat x = false
Instances For
- ctxInfo : Lean.Elab.ContextInfo
- tacticInfo : Lean.Elab.TacticInfo
- useAfter : Bool
- indented : Bool
Whether the tactic info is further indented than the hover position.
- priority : Nat
Instances For
Try to retrieve TacticInfo
for hoverPos
.
We retrieve all TacticInfo
nodes s.t. hoverPos
is inside the node's range plus trailing whitespace.
We usually prefer the innermost such nodes so that for composite tactics such as induction
, we show the nested proofs' states.
However, if hoverPos
is after the tactic, we prefer nodes that are not indented relative to it, meaning that e.g. at |
in
have := by
exact foo
|
we show the (final, see below) state of have
, not exact
.
Moreover, we instruct the LSP server to use the state after tactic execution if
- the hover position is after the info's start position and
- there is no nested tactic info after the hover position (tactic combinators should decide for themselves
where to show intermediate states by calling
withTacticInfoContext
)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Elab.InfoTree.goalsAt?.isEmptyBy stx = (stx.getNumArgs == 2 && Lean.Syntax.isToken "by" stx[0] && stx[1].getNumArgs == 1 && stx[1][0].isMissing)