One can think of this module as being a partial reimplementation of Lean.Elab.Frontend which also stores a snapshot of the world after each command. Importantly, we allow (re)starting compilation from any snapshot/position in the file for interactive editing purposes.
Where the command which produced this snapshot begins. Note that neighbouring snapshots are not necessarily attached beginning-to-end, since inputs outside the grammar advance the parser but do not produce snapshots.
beginPos : String.Pos- stx : Lean.Syntax
- mpState : Lean.Parser.ModuleParserState
- cmdState : Lean.Elab.Command.State
We cache interactive diagnostics in order not to invoke the pretty-printer again on messages from previous snapshots when publishing diagnostics for every new snapshot (this is quadratic), as well as not to invoke it once again when handling
$/lean/interactiveDiagnostics
.interactiveDiags : Lean.PersistentArray Lean.Widget.InteractiveDiagnostic- tacticCache : IO.Ref Lean.Elab.Tactic.Cache
What Lean knows about the world after the header and each command.
Instances For
Equations
- Lean.Server.Snapshots.Snapshot.endPos s = s.mpState.pos
Equations
- Lean.Server.Snapshots.Snapshot.env s = s.cmdState.env
Equations
- Lean.Server.Snapshots.Snapshot.msgLog s = s.cmdState.messages
Equations
- Lean.Server.Snapshots.Snapshot.diagnostics s = Lean.PersistentArray.map (fun d => Lean.Widget.InteractiveDiagnostic.toDiagnostic d) s.interactiveDiags
Equations
- One or more equations did not get rendered due to their size.
Equations
Use the command state in the given snapshot to run a CommandElabM
.
Equations
- One or more equations did not get rendered due to their size.
Run a CoreM
computation using the data in the given snapshot.
Equations
- Lean.Server.Snapshots.Snapshot.runCoreM snap meta c = Lean.Server.Snapshots.Snapshot.runCommandElabM snap meta (Lean.Elab.Command.liftCoreM c)
Run a TermElabM
computation using the data in the given snapshot.
Equations
Parses the next command occurring after the given snapshot without elaborating it.
Equations
- One or more equations did not get rendered due to their size.
Compiles the next command occurring after the given snapshot. If there is no next command
(file ended), Snapshot.isAtEnd
will hold of the return value.
Equations
- One or more equations did not get rendered due to their size.
Compute the current interactive diagnostics log by finding a "diff" relative to the parent
snapshot. We need to do this because unlike the MessageLog
itself, interactive diags are not
part of the command state.
Equations
- One or more equations did not get rendered due to their size.