A utility for simple incremental commands #
A snapshot for the result of command elaboration
- stx : Lean.Syntax
The syntax that was being elaborated
- state : Lean.Elab.Command.State
The state after command elaboration
- error? : Option Lean.Exception
The exception thrown during command elaboration, if any
- moreSnaps : Array (Lean.Language.SnapshotTask Lean.Language.SnapshotTree)
Snapshot tasks produced by
logSnapshotTaskduring command elaboration
Instances For
The snapshot type for simpleIncrementalElab
The result for the previous execution of the command
- lastNoSyntaxErrorResult? : Option CommandElabResultSnapshot
The last result that didn't error because of missing syntax
Instances For
Equations
- Batteries.Tactic.instTypeNameSimpleIncrementalSnapshot = Batteries.Tactic.inst✝
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.
Wraps cmd with simple incrementality handling that makes the command not re-run if only trailing
whitespace was changed or when a syntax error gets introduced and then removed again.
To make this work, cmd doesn't receive the trailing whitespace of the command and doesn't have
access to incrementality itself.
To make use of this, you have to write an explicit elaborator (i.e. a declaration with a
@[command_elab]) and tag it with @[incremental] and then wrap the body in
simpleIncrementalElab. Example:
syntax (name := expensiveCmd) "#expensive_command" : command
@[command_elab expensiveCmd, incremental]
def elabExpensiveCmd : CommandElab := simpleIncrementalElab fun stx => do
...
Equations
- One or more equations did not get rendered due to their size.