A custom piece of code that is run on the editor client.
The editor can use the Lean.Widget.getWidgetSource
RPC method to
get this object.
See the manual entry above this declaration for more information on how to use the widgets system.
- sourcetext : String
Sourcetext of the code to run.
Instances For
Equations
- Lean.Widget.instInhabitedWidgetSource = { default := { sourcetext := default } }
Equations
Equations
- Lean.Widget.instFromJsonWidgetSource = { fromJson? := Lean.Widget.fromJsonWidgetSource✝ }
Use this structure and the @[widget]
attribute to define your own widgets.
@[widget]
def rubiks : UserWidgetDefinition :=
{ name := "Rubiks cube app"
javascript := include_str ...
}
- name : String
Pretty name of user widget to display to the user.
- javascript : String
An ESmodule that exports a react component to render.
Instances For
Equations
- Lean.Widget.instInhabitedUserWidgetDefinition = { default := { name := default, javascript := default } }
Equations
- Lean.Widget.instInhabitedUserWidget = { default := { id := default, name := default, javascriptHash := default } }
Equations
- Lean.Widget.instToJsonUserWidget = { toJson := Lean.Widget.toJsonUserWidget✝ }
Equations
- Lean.Widget.instFromJsonUserWidget = { fromJson? := Lean.Widget.fromJsonUserWidget✝ }
Input for getWidgetSource
RPC.
- hash : UInt64
The hash of the sourcetext to retrieve.
- pos : Lean.Lsp.Position
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Try to retrieve the UserWidgetInfo
at a particular position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get the UserWidget
s present at a particular position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Save a user-widget instance to the infotree.
The given widgetId
should be the declaration name of the widget definition.
Equations
- Lean.Widget.saveWidgetInfo widgetId props stx = let info := Lean.Elab.Info.ofUserWidgetInfo { stx := stx, widgetId := widgetId, props := props }; Lean.Elab.pushInfoLeaf info
Instances For
Widget command #
Use #widget <widgetname> <props>
to display a widget. Useful for debugging widgets.
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.