Instances For
- information: Lean.MessageSeverity
- warning: Lean.MessageSeverity
- error: Lean.MessageSeverity
Instances For
Equations
- Lean.instInhabitedMessageSeverity = { default := Lean.MessageSeverity.information }
- env : Lean.Environment
- mctx : Lean.MetavarContext
- lctx : Lean.LocalContext
- opts : Lean.Options
Instances For
A naming context is the information needed to shorten names in pretty printing.
It gives the current namespace and the list of open declarations.
- currNamespace : Lean.Name
- openDecls : List Lean.OpenDecl
Instances For
- cls : Lean.Name
Trace class, e.g.
Elab.step
. - startTime : Float
Start time in seconds; 0 if unknown to avoid
Option
allocation. - stopTime : Float
Stop time in seconds; 0 if unknown to avoid
Option
allocation. - collapsed : Bool
Whether trace node defaults to collapsed in the infoview.
- tag : String
Optional tag shown in
trace.profiler.output
output after the trace class name.
Instances For
Structured message data. We use it for reporting errors, trace messages, etc.
- ofFormatWithInfos: Lean.FormatWithInfos → Lean.MessageData
Eagerly formatted text with info annotations. This constructor is inspected in various hacks.
- ofGoal: Lean.MVarId → Lean.MessageData
- ofWidget: Lean.Widget.WidgetInstance → Lean.MessageData → Lean.MessageData
A widget instance.
In
ofWidget wi alt
, the nested messagealt
should approximate the contents of the widget without itself usingofWidget wi _
. This is used as fallback in environments that cannot display user widgets.alt
may nest any structured message, for exampleofGoal
to approximate a tactic state widget, and, if necessary, even other widget instances (for which approximations are computed recursively). - withContext: Lean.MessageDataContext → Lean.MessageData → Lean.MessageData
withContext ctx d
specifies the pretty printing context(env, mctx, lctx, opts)
for the nested expressions ind
. - withNamingContext: Lean.NamingContext → Lean.MessageData → Lean.MessageData
- nest: Nat → Lean.MessageData → Lean.MessageData
Lifted
Format.nest
- group: Lean.MessageData → Lean.MessageData
Lifted
Format.group
- compose: Lean.MessageData → Lean.MessageData → Lean.MessageData
Lifted
Format.compose
- tagged: Lean.Name → Lean.MessageData → Lean.MessageData
Tagged sections.
Name
should be viewed as a "kind", and is used byMessageData
inspector functions. Example: an inspector that tries to find "definitional equality failures" may look for the tag "DefEqFailure". - trace: Lean.TraceData → Lean.MessageData → Array Lean.MessageData → Lean.MessageData
- ofLazy: (Option Lean.PPContext → IO Dynamic) → (Lean.MetavarContext → Bool) → Lean.MessageData
A lazy message. The provided thunk will not be run until it is about to be displayed. This can save computation in cases where the message may never be seen.
The
Dynamic
value is expected to be aMessageData
, which is a workaround for the positivity restriction.If the thunked message is produced for a term that contains a synthetic sorry,
hasSyntheticSorry
should returntrue
. This is used to filter out certain messages.
Instances For
Equations
- Lean.instInhabitedMessageData = { default := Lean.MessageData.ofGoal default }
Eagerly formatted text.
Equations
- Lean.MessageData.ofFormat fmt = Lean.MessageData.ofFormatWithInfos { fmt := fmt, infos := Lean.RBMap.empty }
Instances For
Lazy message data production, with access to the context as given by
a surrounding MessageData.withContext
(which is expected to exist).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns true when the message contains a MessageData.tagged tag ..
constructor where p tag
is true.
This does not descend into lazily generated subtrees (.ofLazy
); message tags
of interest (like those added by logLinter
) are expected to be near the root
of the MessageData
, and not hidden inside .ofLazy
.
Returns the top-level tag of the message.
If none, returns Name.anonymous
.
This does not descend into message subtrees (e.g., .compose
, .ofLazy
).
The message kind is expected to describe the whole message.
Equations
- (Lean.MessageData.withContext a msg).kind = msg.kind
- (Lean.MessageData.withNamingContext a msg).kind = msg.kind
- (Lean.MessageData.tagged n a).kind = n
- x.kind = Lean.Name.anonymous
Instances For
An empty message.
Instances For
Equations
- Lean.MessageData.mkPPContext nCtx ctx = { env := ctx.env, mctx := ctx.mctx, lctx := ctx.lctx, opts := ctx.opts, currNamespace := nCtx.currNamespace, openDecls := nCtx.openDecls }
Instances For
Simply formats the name.
See MessageData.ofConstName
for richer messages.
Instances For
Represents a constant name such that hovering and "go to definition" works.
If there is no such constant in the environment, the name is simply formatted, but sanitized if it is a hygienic name.
Use MessageData.ofName
if hovers are undesired.
If fullNames
is true, then pretty prints as if pp.fullNames
is true.
Otherwise, pretty prints using the current user setting for pp.fullNames
.
Instances For
Equations
- msg.hasSyntheticSorry = Lean.MessageData.hasSyntheticSorry.visit none msg
Instances For
Instances For
Equations
- Lean.MessageData.instAppend = { append := Lean.MessageData.compose }
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Wrap the given message in l
and r
. See also Format.bracket
.
Equations
- Lean.MessageData.bracket l f r = (Lean.MessageData.nest l.length ((Lean.MessageData.ofFormat ∘ Lean.format) l ++ f ++ (Lean.MessageData.ofFormat ∘ Lean.format) r)).group
Instances For
Wrap the given message in parentheses ()
.
Equations
- f.paren = Lean.MessageData.bracket "(" f ")"
Instances For
Wrap the given message in square brackets []
.
Equations
- f.sbracket = Lean.MessageData.bracket "[" f "]"
Instances For
Append the given list of messages with the given separator.
Instances For
Write the given list of messages as a list, separating each item with ,\n
and surrounding with square brackets.
Equations
- Lean.MessageData.ofList [] = (Lean.MessageData.ofFormat ∘ Lean.format) "[]"
- Lean.MessageData.ofList x = (Lean.MessageData.joinSep x (Lean.MessageData.ofFormat (Std.Format.text ",") ++ Lean.MessageData.ofFormat Lean.Format.line)).sbracket
Instances For
See MessageData.ofList
.
Equations
- Lean.MessageData.ofArray msgs = Lean.MessageData.ofList msgs.toList
Instances For
Puts MessageData
into a comma-separated list with "or"
at the back (no Oxford comma).
Best used on non-empty lists; returns "– none –"
for an empty list.
Instances For
Puts MessageData
into a comma-separated list with "and"
at the back (no Oxford comma).
Best used on non-empty lists; returns "– none –"
for an empty list.
Instances For
A BaseMessage
is a richly formatted piece of information emitted by Lean.
They are rendered by client editors in the infoview and in diagnostic windows.
There are two varieties in the Lean core:
Message
: Uses structured, effectfulMessageData
for formatting content.SerialMessage
: Stores pureString
data. Obtained by running the effectfulMessage.serialize
.
- fileName : String
- pos : Lean.Position
- endPos : Option Lean.Position
- keepFullRange : Bool
If
true
, report range as given; seemsgToInteractiveDiagnostic
. - severity : Lean.MessageSeverity
- data : α
The content of the message.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.instToJsonBaseMessage = { toJson := Lean.toJsonBaseMessage✝ }
A Message
is a richly formatted piece of information emitted by Lean.
They are rendered by client editors in the infoview and in diagnostic windows.
Instances For
A SerialMessage
is a Message
whose MessageData
has been eagerly
serialized and is thus appropriate for use in pure contexts where the effectful
MessageData.toString
cannot be used.
- kind : Lean.Name
The message kind (i.e., the top-level tag).
Instances For
Equations
- Lean.instToJsonSerialMessage = { toJson := Lean.toJsonSerialMessage✝ }
Equations
- Lean.instFromJsonSerialMessage = { fromJson? := Lean.fromJsonSerialMessage✝ }
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
Serializes the message, converting its data into a string and saving its kind.
Instances For
Equations
Instances For
Equations
- msg.toJson = do let __do_lift ← msg.serialize pure (inline (Lean.toJson __do_lift))
Instances For
A persistent array of messages.
In the Lean elaborator, we use a fresh message log per command but may also report diagnostics at
various points inside a command, which will empty unreported
and updated hadErrors
accordingly
(see CoreM.getAndEmptyMessageLog
).
- hadErrors : Bool
If true, there was an error in the log previously that has already been reported to the user and removed from the log. Thus we say that in the current context (usually the current command), we "have errors" if either this flag is set or there is an error in
msgs
; seeMessageLog.hasErrors
. If we have errors, we suppress some error messages that are often the result of a previous error. - unreported : Lean.PersistentArray Lean.Message
The list of messages not already reported, in insertion order.
- reportedKinds : Lean.NameSet
Set of message kinds that have been added to the log. For example, we have the kind
unsafe.exponentiation.warning
for warning messages associated with the configuration optionexponentiation.threshold
. We don't produce a warning if the kind is already in the following set.
Instances For
Equations
- Lean.instInhabitedMessageLog = { default := { hadErrors := default, unreported := default, reportedKinds := default } }
Instances For
Equations
- Lean.MessageLog.add msg log = { hadErrors := log.hadErrors, unreported := log.unreported.push msg, reportedKinds := log.reportedKinds }
Instances For
Equations
- Lean.MessageLog.instAppend = { append := Lean.MessageLog.append }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- log.forM f = log.unreported.forM f
Instances For
Converts the unreported messages to a list, oldest message first.
Instances For
Converts the unreported messages to an array, oldest message first.
Instances For
Equations
- msg.nestD = Lean.MessageData.nest 2 msg
Instances For
Equations
Instances For
- addMessageContext : Lean.MessageData → m Lean.MessageData
Without context, a
MessageData
object may be missing information (e.g. hover info) for pretty printing, or may print an error. Hence,addMessageContext
should be called on all constructedMessageData
(e.g. viam!
) before taking it out of context (e.g. leavingMetaM
orCoreM
).
Instances
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- Lean.instToMessageDataExpr = { toMessageData := Lean.MessageData.ofExpr }
Equations
- Lean.instToMessageDataFormat = { toMessageData := Lean.MessageData.ofFormat }
Equations
- Lean.instToMessageDataMVarId = { toMessageData := Lean.MessageData.ofGoal }
Equations
- Lean.instToMessageDataArray = { toMessageData := fun (as : Array α) => Lean.toMessageData as.toList }
Equations
- Lean.instToMessageDataSubarray = { toMessageData := fun (as : Subarray α) => Lean.toMessageData as.toArray.toList }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.toMessageList msgs = Lean.indentD (Lean.MessageData.joinSep msgs.toList (Lean.toMessageData "\n\n"))
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Lean.KernelException.other msg).toMessageData opts = Lean.toMessageData "(kernel) " ++ Lean.toMessageData msg ++ Lean.toMessageData ""
- Lean.KernelException.deterministicTimeout.toMessageData opts = (Lean.MessageData.ofFormat ∘ Lean.format) "(kernel) deterministic timeout"
- Lean.KernelException.excessiveMemory.toMessageData opts = (Lean.MessageData.ofFormat ∘ Lean.format) "(kernel) excessive memory consumption detected"
- Lean.KernelException.deepRecursion.toMessageData opts = (Lean.MessageData.ofFormat ∘ Lean.format) "(kernel) deep recursion detected"
- Lean.KernelException.interrupted.toMessageData opts = (Lean.MessageData.ofFormat ∘ Lean.format) "(kernel) interrupted"