Documentation

Lean.Widget.UserWidget

@[implemented_by _private.Lean.Widget.UserWidget.0.Lean.Widget.evalModuleUnsafe]
@[implemented_by _private.Lean.Widget.UserWidget.0.Lean.Widget.evalWidgetInstanceUnsafe]

Storage of widget modules #

class Lean.Widget.ToModule (α : Type u) :
Instances
    @[implicit_reducible]
    Instances For

      Registers a widget module. Its type must implement Lean.Widget.ToModule.

      Retrieval of widget modules #

      Instances For
        • sourcetext : String

          Sourcetext of the JS module to run.

        Instances For

          Storage of panel widget instances #

          Instances For
            Instances For
              Instances For
                Instances For

                  Construct a widget instance by finding a widget module in the current environment.

                  hash must be hash (toModule c).javascript where c is some global constant annotated with @[widget_module], or the name of a builtin widget module.

                  Instances For

                    Save the data of a panel widget which will be displayed whenever the text cursor is on stx.

                    hash must be as in WidgetInstance.ofHash.

                    For panel widgets, the Lean infoview appends additional fields to the props object: see https://github.com/leanprover/vscode-lean4/blob/master/lean4-infoview/src/infoview/userWidget.tsx#L145.

                    Instances For

                      Deprecated definitions #

                      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
                        @[implemented_by _private.Lean.Widget.UserWidget.0.Lean.Widget.evalUserWidgetDefinitionUnsafe]

                        Retrieving panel widget instances #

                        Retrieve all the UserWidgetInfos that intersect a given line.

                        Instances For
                          Instances For

                            Output of getWidgets RPC.

                            Instances For

                              Get the panel widgets present around a particular position.

                              Instances For