File: .lake/packages/lean4/src/lean/Lean/Widget/UserWidget.lean

full_name: Lean.Widget.Module.javascriptHash
code: /-- A widget module is a unit of source code that can execute in the infoview.

Every module definition must either be annotated with `@[widget_module]`,
or use a value of `javascript` identical to that of another definition
annotated with `@[widget_module]`.
This makes it possible for the infoview to load the module.

See the [manual entry](https://lean-lang.org/lean4/doc/examples/widgets.lean.html)
for more information on how to use the widgets system. -/
structure Module where
  /-- A JS [module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
  intended for use in user widgets.

  The JS environment in which modules execute
  provides a fixed set of libraries accessible via direct `import`,
  notably [`@leanprover/infoview`](https://www.npmjs.com/package/@leanprover/infoview)
  and [`react`](https://www.npmjs.com/package/react).

  To initialize this field from an external JS file,
  you may use `include_str "path"/"to"/"file.js"`.
  However **beware** that this does not register a dependency with Lake,
  so your Lean module will not automatically be rebuilt
  when the `.js` file changes. -/
  javascript : String
  /-- The hash is cached to avoid recomputing it whenever the `Module` is used. -/
  javascriptHash : { x : UInt64 // x = hash javascript } := ⟨hash javascript, rfl⟩
goal: { x // x = hash self.javascript }

full_name: Lean.Widget.Module
code: /-- A widget module is a unit of source code that can execute in the infoview.

Every module definition must either be annotated with `@[widget_module]`,
or use a value of `javascript` identical to that of another definition
annotated with `@[widget_module]`.
This makes it possible for the infoview to load the module.

See the [manual entry](https://lean-lang.org/lean4/doc/examples/widgets.lean.html)
for more information on how to use the widgets system. -/
structure Module where
  /-- A JS [module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
  intended for use in user widgets.

  The JS environment in which modules execute
  provides a fixed set of libraries accessible via direct `import`,
  notably [`@leanprover/infoview`](https://www.npmjs.com/package/@leanprover/infoview)
  and [`react`](https://www.npmjs.com/package/react).

  To initialize this field from an external JS file,
  you may use `include_str "path"/"to"/"file.js"`.
  However **beware** that this does not register a dependency with Lake,
  so your Lean module will not automatically be rebuilt
  when the `.js` file changes. -/
  javascript : String
  /-- The hash is cached to avoid recomputing it whenever the `Module` is used. -/
  javascriptHash : { x : UInt64 // x = hash javascript } := ⟨hash javascript, rfl⟩
goal: Type

full_name: Lean.Widget.Module.javascript
code: /-- A widget module is a unit of source code that can execute in the infoview.

Every module definition must either be annotated with `@[widget_module]`,
or use a value of `javascript` identical to that of another definition
annotated with `@[widget_module]`.
This makes it possible for the infoview to load the module.

See the [manual entry](https://lean-lang.org/lean4/doc/examples/widgets.lean.html)
for more information on how to use the widgets system. -/
structure Module where
  /-- A JS [module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
  intended for use in user widgets.

  The JS environment in which modules execute
  provides a fixed set of libraries accessible via direct `import`,
  notably [`@leanprover/infoview`](https://www.npmjs.com/package/@leanprover/infoview)
  and [`react`](https://www.npmjs.com/package/react).

  To initialize this field from an external JS file,
  you may use `include_str "path"/"to"/"file.js"`.
  However **beware** that this does not register a dependency with Lake,
  so your Lean module will not automatically be rebuilt
  when the `.js` file changes. -/
  javascript : String
  /-- The hash is cached to avoid recomputing it whenever the `Module` is used. -/
  javascriptHash : { x : UInt64 // x = hash javascript } := ⟨hash javascript, rfl⟩
goal: String

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.evalModuleUnsafe
code: private unsafe def evalModuleUnsafe (e : Expr) : MetaM Module 
goal: Lean.MetaM Lean.Widget.Module

full_name: Lean.Widget.evalModule
code: @[implemented_by evalModuleUnsafe]
opaque evalModule (e : Expr) : MetaM Module
goal: Lean.MetaM Lean.Widget.Module

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.evalWidgetInstanceUnsafe
code: private unsafe def evalWidgetInstanceUnsafe (e : Expr) : MetaM WidgetInstance 
goal: Lean.MetaM Lean.Widget.WidgetInstance

full_name: Lean.Widget.evalWidgetInstance
code: @[implemented_by evalWidgetInstanceUnsafe]
opaque evalWidgetInstance (e : Expr) : MetaM WidgetInstance
goal: Lean.MetaM Lean.Widget.WidgetInstance

full_name: Lean.Widget.ToModule.toModule
code: class ToModule (α : Type u) where
  toModule : α → Module
goal: α → Lean.Widget.Module

full_name: Lean.Widget.ToModule
code: class ToModule (α : Type u) where
  toModule : α → Module
goal: Type u

full_name: Lean.Widget.instToModuleModule
code: instance : ToModule Module 
goal: Lean.Widget.ToModule Lean.Widget.Module

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.90
code: private builtin_initialize builtinModulesRef : IO.Ref (RBMap UInt64 (Name × Module) compare) ←
  IO.mkRef ∅
goal: IO (IO.Ref (Lean.RBMap UInt64 (Lean.Name × Lean.Widget.Module) compare))

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.builtinModulesRef
code: private builtin_initialize builtinModulesRef : IO.Ref (RBMap UInt64 (Name × Module) compare) ←
  IO.mkRef ∅
goal: IO.Ref (Lean.RBMap UInt64 (Lean.Name × Lean.Widget.Module) compare)

full_name: Lean.Widget.addBuiltinModule
code: def addBuiltinModule (id : Name) (m : Module) : IO Unit 
goal: IO Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.ModuleRegistry
code: /-- Every constant `c : α` marked with `@[widget_module]` is registered here.
The registry maps `hash (toModule c).javascript` to ``(`c, `(@toModule α inst c))``
where `inst : ToModule α` is synthesized during registration time
and stored thereafter. -/
private abbrev ModuleRegistry 
goal: Type

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.185
code: builtin_initialize moduleRegistry : ModuleRegistry ←
  registerSimplePersistentEnvExtension {
    addImportedFn := fun xss => xss.foldl (Array.foldl (fun s n => s.insert n.1 n.2)) ∅
    addEntryFn    := fun s n => s.insert n.1 n.2
    toArrayFn     := fun es => es.toArray
  }
goal: IO Lean.Widget.ModuleRegistry

full_name: Lean.Widget.moduleRegistry
code: builtin_initialize moduleRegistry : ModuleRegistry ←
  registerSimplePersistentEnvExtension {
    addImportedFn := fun xss => xss.foldl (Array.foldl (fun s n => s.insert n.1 n.2)) ∅
    addEntryFn    := fun s n => s.insert n.1 n.2
    toArrayFn     := fun es => es.toArray
  }
goal: Lean.Widget.ModuleRegistry

full_name: Lean.Widget.widgetModuleAttrImpl
code: /--
Registers `[builtin_widget_module]` and `[widget_module]` and binds the latter's implementation
(used for creating the obsolete `[widget]` alias below).
 -/
builtin_initialize widgetModuleAttrImpl : AttributeImpl ←
  let mkAttr (builtin : Bool) (name : Name) := do
    let impl := {
      name
      descr           := (if builtin then "(builtin) " else "") ++
        "Registers a widget module. Its type must implement Lean.Widget.ToModule."
      applicationTime := .afterCompilation
      add             := fun decl stx kind => Prod.fst <$> MetaM.run do
        Attribute.Builtin.ensureNoArgs stx
        unless kind == AttributeKind.global do throwError "invalid attribute '{name}', must be global"
        let e ← mkAppM ``ToModule.toModule #[.const decl []]
        let mod ← evalModule e
        let env ← getEnv
        unless builtin do  -- don't warn on collision between previous and current stage
          if let some _ := (← builtinModulesRef.get).find? mod.javascriptHash then
            logWarning m!"A builtin widget module with the same hash(JS source code) was already registered."
        if let some (n, _) := moduleRegistry.getState env |>.find? mod.javascriptHash then
          logWarning m!"A widget module with the same hash(JS source code) was already registered at {Expr.const n []}."
        let env ← getEnv
        if builtin then
          let h := mkConst decl
          declareBuiltin decl <| mkApp2 (mkConst ``addBuiltinModule) (toExpr decl) h
        else
          setEnv <| moduleRegistry.addEntry env (mod.javascriptHash, decl, e)
    }
    registerBuiltinAttribute impl
    return impl
  let _ ← mkAttr true `builtin_widget_module
  mkAttr false `widget_module
goal: Lean.AttributeImpl

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.245
code: /--
Registers `[builtin_widget_module]` and `[widget_module]` and binds the latter's implementation
(used for creating the obsolete `[widget]` alias below).
 -/
builtin_initialize widgetModuleAttrImpl : AttributeImpl ←
  let mkAttr (builtin : Bool) (name : Name) := do
    let impl := {
      name
      descr           := (if builtin then "(builtin) " else "") ++
        "Registers a widget module. Its type must implement Lean.Widget.ToModule."
      applicationTime := .afterCompilation
      add             := fun decl stx kind => Prod.fst <$> MetaM.run do
        Attribute.Builtin.ensureNoArgs stx
        unless kind == AttributeKind.global do throwError "invalid attribute '{name}', must be global"
        let e ← mkAppM ``ToModule.toModule #[.const decl []]
        let mod ← evalModule e
        let env ← getEnv
        unless builtin do  -- don't warn on collision between previous and current stage
          if let some _ := (← builtinModulesRef.get).find? mod.javascriptHash then
            logWarning m!"A builtin widget module with the same hash(JS source code) was already registered."
        if let some (n, _) := moduleRegistry.getState env |>.find? mod.javascriptHash then
          logWarning m!"A widget module with the same hash(JS source code) was already registered at {Expr.const n []}."
        let env ← getEnv
        if builtin then
          let h := mkConst decl
          declareBuiltin decl <| mkApp2 (mkConst ``addBuiltinModule) (toExpr decl) h
        else
          setEnv <| moduleRegistry.addEntry env (mod.javascriptHash, decl, e)
    }
    registerBuiltinAttribute impl
    return impl
  let _ ← mkAttr true `builtin_widget_module
  mkAttr false `widget_module
goal: IO Lean.AttributeImpl

full_name: Lean.Widget.GetWidgetSourceParams.pos
code: structure GetWidgetSourceParams where
  /-- Hash of the JS module to retrieve. -/
  hash : UInt64
  pos : Lean.Lsp.Position
  deriving ToJson, FromJson
goal: Lean.Lsp.Position

full_name: Lean.Widget.GetWidgetSourceParams
code: structure GetWidgetSourceParams where
  /-- Hash of the JS module to retrieve. -/
  hash : UInt64
  pos : Lean.Lsp.Position
  deriving ToJson, FromJson
goal: Type

full_name: Lean.Widget.GetWidgetSourceParams.hash
code: structure GetWidgetSourceParams where
  /-- Hash of the JS module to retrieve. -/
  hash : UInt64
  pos : Lean.Lsp.Position
  deriving ToJson, FromJson
goal: UInt64

full_name: Lean.Widget.instToJsonGetWidgetSourceParams
code: ToJson
goal: Lean.ToJson Lean.Widget.GetWidgetSourceParams

full_name: Lean.Widget.instFromJsonGetWidgetSourceParams
code: FromJson
goal: Lean.FromJson Lean.Widget.GetWidgetSourceParams

full_name: Lean.Widget.instInhabitedWidgetSource
code: structure WidgetSource where
  /-- Sourcetext of the JS module to run. -/
  sourcetext : String
  deriving Inhabited, ToJson, FromJson
goal: Inhabited Lean.Widget.WidgetSource

full_name: Lean.Widget.WidgetSource.sourcetext
code: structure WidgetSource where
  /-- Sourcetext of the JS module to run. -/
  sourcetext : String
  deriving Inhabited, ToJson, FromJson
goal: String

full_name: Lean.Widget.WidgetSource
code: structure WidgetSource where
  /-- Sourcetext of the JS module to run. -/
  sourcetext : String
  deriving Inhabited, ToJson, FromJson
goal: Type

full_name: Lean.Widget.instToJsonWidgetSource
code: ToJson
goal: Lean.ToJson Lean.Widget.WidgetSource

full_name: Lean.Widget.instFromJsonWidgetSource
code: FromJson
goal: Lean.FromJson Lean.Widget.WidgetSource

full_name: Lean.Widget.getWidgetSource
code: def getWidgetSource (args : GetWidgetSourceParams) : RequestM (RequestTask WidgetSource) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Widget.WidgetSource)

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.1357
code: builtin_initialize
  Server.registerBuiltinRpcProcedure ``getWidgetSource _ _ getWidgetSource
goal: IO Unit

full_name: Lean.Widget.PanelWidgetsExtEntry.local
code: inductive PanelWidgetsExtEntry where
  | «global» (n : Name)
  | «local» (wi : WidgetInstance)
goal: Lean.Widget.PanelWidgetsExtEntry

full_name: Lean.Widget.PanelWidgetsExtEntry.global
code: inductive PanelWidgetsExtEntry where
  | «global» (n : Name)
  | «local» (wi : WidgetInstance)
goal: Lean.Widget.PanelWidgetsExtEntry

full_name: Lean.Widget.PanelWidgetsExtEntry
code: inductive PanelWidgetsExtEntry where
  | «global» (n : Name)
  | «local» (wi : WidgetInstance)
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.PanelWidgetsExt
code: /-- Keeps track of panel widget instances that should be displayed.

Instances can be registered for display global
(i.e., persisted in `.olean`s) and locally (not persisted)

For globally displayed widgets
we cannot store a `WidgetInstance` in the persistent state
because it contains a `StateM` closure.
Instead, we add a global constant of type `WidgetInstance`
to the environment, and store its name in the extension.

For locally displayed ones, we just store a `WidgetInstance`
in the extension directly.
This is okay because it is never persisted.

The (persistent) entries are then of the form `(h, n)`
where `h` is a hash stored in the `moduleRegistry`
and `n` is the name of a `WidgetInstance` global constant.

The extension state maps each `h` as above
to a list of entries that can be either global or local ones.
Each element of the state indicates that the widget module `h`
should be displayed with the given `WidgetInstance` as its arguments.

This is similar to a parametric attribute, except that:
- parametric attributes map at most one parameter to one tagged declaration,
  whereas we may display multiple instances of a single widget module; and
- parametric attributes use the same type for local and global entries,
  which we cannot do owing to the closure. -/
private abbrev PanelWidgetsExt 
goal: Type

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.1416
code: builtin_initialize panelWidgetsExt : PanelWidgetsExt ←
  registerSimpleScopedEnvExtension {
    addEntry := fun s (h, n) => s.insert h (.global n :: s.findD h [])
    initial  := .empty
  }
goal: IO Lean.Widget.PanelWidgetsExt

full_name: Lean.Widget.panelWidgetsExt
code: builtin_initialize panelWidgetsExt : PanelWidgetsExt ←
  registerSimpleScopedEnvExtension {
    addEntry := fun s (h, n) => s.insert h (.global n :: s.findD h [])
    initial  := .empty
  }
goal: Lean.Widget.PanelWidgetsExt

full_name: Lean.Widget.evalPanelWidgets
code: def evalPanelWidgets : MetaM (Array WidgetInstance) 
goal: Lean.MetaM (Array Lean.Widget.WidgetInstance)

full_name: Lean.Widget.addPanelWidgetGlobal
code: def addPanelWidgetGlobal [Monad m] [MonadEnv m] [MonadResolveName m] (h : UInt64) (n : Name) : m Unit 
goal: m Unit

full_name: Lean.Widget.addPanelWidgetScoped
code: def addPanelWidgetScoped [Monad m] [MonadEnv m] [MonadResolveName m] (h : UInt64) (n : Name) : m Unit 
goal: m Unit

full_name: Lean.Widget.addPanelWidgetLocal
code: def addPanelWidgetLocal [Monad m] [MonadEnv m] (wi : WidgetInstance) : m Unit 
goal: m Unit

full_name: Lean.Widget.erasePanelWidget
code: def erasePanelWidget [Monad m] [MonadEnv m] (h : UInt64) : m Unit 
goal: m Unit

full_name: Lean.Widget.WidgetInstance.ofHash
code: /-- 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. -/
def WidgetInstance.ofHash (hash : UInt64) (props : StateM Server.RpcObjectStore Json) :
    CoreM WidgetInstance 
goal: Lean.CoreM Lean.Widget.WidgetInstance

full_name: Lean.Widget.savePanelWidgetInfo
code: /-- 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`. -/
def savePanelWidgetInfo (hash : UInt64) (props : StateM Server.RpcObjectStore Json) (stx : Syntax) :
    CoreM Unit 
goal: Lean.CoreM Unit

full_name: Lean.Widget.widgetInstanceSpec
code: syntax widgetInstanceSpec := ident ("with " term)?
goal: Lean.ParserDescr

full_name: Lean.Widget.elabWidgetInstanceSpecAux
code: def elabWidgetInstanceSpecAux (mod : Ident) (props : Term) : TermElabM Expr 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: Lean.Widget.elabWidgetInstanceSpec
code: def elabWidgetInstanceSpec : TSyntax ``widgetInstanceSpec → TermElabM Expr
  
goal: Lean.TSyntax `Lean.Widget.widgetInstanceSpec → Lean.Elab.TermElabM Lean.Expr

full_name: Lean.Widget.addWidgetSpec
code: syntax addWidgetSpec := Parser.Term.attrKind widgetInstanceSpec
goal: Lean.ParserDescr

full_name: Lean.Widget.eraseWidgetSpec
code: syntax eraseWidgetSpec := "-" ident
goal: Lean.ParserDescr

full_name: Lean.Widget.showWidgetSpec
code: syntax showWidgetSpec := addWidgetSpec <|> eraseWidgetSpec
goal: Lean.ParserDescr

full_name: Lean.Widget.showPanelWidgetsCmd
code: /-- Use `show_panel_widgets [<widget>]` to mark that `<widget>`
should always be displayed, including in downstream modules.

The type of `<widget>` must implement `Widget.ToModule`,
and the type of `<props>` must implement `Server.RpcEncodable`.
In particular, `<props> : Json` works.

Use `show_panel_widgets [<widget> with <props>]`
to specify the `<props>` that the widget should be given
as arguments.

Use `show_panel_widgets [local <widget> (with <props>)?]` to mark it
for display in the current section, namespace, or file only.

Use `show_panel_widgets [scoped <widget> (with <props>)?]` to mark it
for display only when the current namespace is open.

Use `show_panel_widgets [-<widget>]` to temporarily hide a previously shown widget
in the current section, namespace, or file.
Note that persistent erasure is not possible, i.e.,
`-<widget>` has no effect on downstream modules. -/
syntax (name := showPanelWidgetsCmd) "show_panel_widgets " "[" sepBy1(showWidgetSpec, ", ") "]" : command
goal: Lean.ParserDescr

full_name: Lean.Widget.elabShowPanelWidgetsCmd
code: @[command_elab showPanelWidgetsCmd] def elabShowPanelWidgetsCmd : CommandElab
  
goal: Lean.Elab.Command.CommandElab

full_name: Lean.Widget.widgetCmd
code: /-- Use `#widget <widget>` to display a panel widget,
and `#widget <widget> with <props>` to display it with the given props.
Useful for debugging widgets.

The type of `<widget>` must implement `Widget.ToModule`,
and the type of `<props>` must implement `Server.RpcEncodable`.
In particular, `<props> : Json` works. -/
syntax (name := widgetCmd) "#widget " widgetInstanceSpec : command
goal: Lean.ParserDescr

full_name: Lean.Widget.elabWidgetCmd
code: @[command_elab widgetCmd] def elabWidgetCmd : CommandElab
  
goal: Lean.Elab.Command.CommandElab

full_name: Lean.Widget.UserWidgetDefinition.javascript
code: /-- Use this structure and the `@[widget]` attribute to define your own widgets.

```lean
@[widget]
def rubiks : UserWidgetDefinition :=
  { name := "Rubiks cube app"
    javascript := include_str ...
  }
```
-/
structure UserWidgetDefinition where
  /-- Pretty name of user widget to display to the user. -/
  name : String
  /-- An ESmodule that exports a react component to render. -/
  javascript: String
  deriving Inhabited, ToJson, FromJson
goal: String

full_name: Lean.Widget.UserWidgetDefinition.name
code: /-- Use this structure and the `@[widget]` attribute to define your own widgets.

```lean
@[widget]
def rubiks : UserWidgetDefinition :=
  { name := "Rubiks cube app"
    javascript := include_str ...
  }
```
-/
structure UserWidgetDefinition where
  /-- Pretty name of user widget to display to the user. -/
  name : String
  /-- An ESmodule that exports a react component to render. -/
  javascript: String
  deriving Inhabited, ToJson, FromJson
goal: String

full_name: Lean.Widget.instInhabitedUserWidgetDefinition
code: /-- Use this structure and the `@[widget]` attribute to define your own widgets.

```lean
@[widget]
def rubiks : UserWidgetDefinition :=
  { name := "Rubiks cube app"
    javascript := include_str ...
  }
```
-/
structure UserWidgetDefinition where
  /-- Pretty name of user widget to display to the user. -/
  name : String
  /-- An ESmodule that exports a react component to render. -/
  javascript: String
  deriving Inhabited, ToJson, FromJson
goal: Inhabited Lean.Widget.UserWidgetDefinition

full_name: Lean.Widget.UserWidgetDefinition
code: /-- Use this structure and the `@[widget]` attribute to define your own widgets.

```lean
@[widget]
def rubiks : UserWidgetDefinition :=
  { name := "Rubiks cube app"
    javascript := include_str ...
  }
```
-/
structure UserWidgetDefinition where
  /-- Pretty name of user widget to display to the user. -/
  name : String
  /-- An ESmodule that exports a react component to render. -/
  javascript: String
  deriving Inhabited, ToJson, FromJson
goal: Type

full_name: Lean.Widget.instToJsonUserWidgetDefinition
code: ToJson
goal: Lean.ToJson Lean.Widget.UserWidgetDefinition

full_name: Lean.Widget.instFromJsonUserWidgetDefinition
code: FromJson
goal: Lean.FromJson Lean.Widget.UserWidgetDefinition

full_name: Lean.Widget.instToModuleUserWidgetDefinition
code: instance : ToModule UserWidgetDefinition 
goal: Lean.Widget.ToModule Lean.Widget.UserWidgetDefinition

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.widgetAttrImpl
code: @[deprecated (since := "2023-12-21")] private def widgetAttrImpl : AttributeImpl 
goal: Lean.AttributeImpl

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.3840
code: builtin_initialize registerBuiltinAttribute widgetAttrImpl
goal: IO Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Widget.UserWidget.0.Lean.Widget.evalUserWidgetDefinitionUnsafe
code: private unsafe def evalUserWidgetDefinitionUnsafe [Monad m] [MonadEnv m] [MonadOptions m] [MonadError m]
    (id : Name) : m UserWidgetDefinition 
goal: m Lean.Widget.UserWidgetDefinition

full_name: Lean.Widget.evalUserWidgetDefinition
code: @[implemented_by evalUserWidgetDefinitionUnsafe]
opaque evalUserWidgetDefinition [Monad m] [MonadEnv m] [MonadOptions m] [MonadError m]
    (id : Name) : m UserWidgetDefinition
goal: m Lean.Widget.UserWidgetDefinition

full_name: Lean.Widget.saveWidgetInfo
code: /-- Save a user-widget instance to the infotree.
    The given `widgetId` should be the declaration name of the widget definition. -/
@[deprecated savePanelWidgetInfo (since := "2023-12-21")] def saveWidgetInfo (widgetId : Name) (props : Json)
    (stx : Syntax) : CoreM Unit 
goal: Lean.CoreM Unit

full_name: Lean.Widget.widgetInfosAt?
code: /-- Retrieve all the `UserWidgetInfo`s that intersect a given line. -/
def widgetInfosAt? (text : FileMap) (t : InfoTree) (hoverLine : Nat) : List UserWidgetInfo 
goal: List Lean.Elab.UserWidgetInfo

full_name: Lean.Widget.PanelWidgetInstance.range?
code: structure PanelWidgetInstance extends WidgetInstance where
  /-- The syntactic span in the Lean file at which the panel widget is displayed. -/
  range? : Option Lsp.Range := none
  /-- When present, the infoview will wrap the widget
  in `<details><summary>{name}</summary>...</details>`.
  This functionality is deprecated
  but retained for backwards compatibility
  with `UserWidgetDefinition`. -/
  name? : Option String := none
  deriving Server.RpcEncodable
goal: Option Lean.Lsp.Range

full_name: Lean.Widget.PanelWidgetInstance
code: structure PanelWidgetInstance extends WidgetInstance where
  /-- The syntactic span in the Lean file at which the panel widget is displayed. -/
  range? : Option Lsp.Range := none
  /-- When present, the infoview will wrap the widget
  in `<details><summary>{name}</summary>...</details>`.
  This functionality is deprecated
  but retained for backwards compatibility
  with `UserWidgetDefinition`. -/
  name? : Option String := none
  deriving Server.RpcEncodable
goal: Type

full_name: Lean.Widget.PanelWidgetInstance.name?
code: structure PanelWidgetInstance extends WidgetInstance where
  /-- The syntactic span in the Lean file at which the panel widget is displayed. -/
  range? : Option Lsp.Range := none
  /-- When present, the infoview will wrap the widget
  in `<details><summary>{name}</summary>...</details>`.
  This functionality is deprecated
  but retained for backwards compatibility
  with `UserWidgetDefinition`. -/
  name? : Option String := none
  deriving Server.RpcEncodable
goal: Option String

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.instToJsonRpcEncodablePacket
code: Server.RpcEncodable
goal: Lean.ToJson Lean.Widget.Lean.Widget.PanelWidgetInstance.RpcEncodablePacket✝

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.instRpcEncodablePanelWidgetInstance
code: Server.RpcEncodable
goal: Lean.Server.RpcEncodable Lean.Widget.PanelWidgetInstance

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.RpcEncodablePacket._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4162
code: Server.RpcEncodable
goal: Type

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.instRpcEncodablePanelWidgetInstance.dec._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4162
code: Server.RpcEncodable
goal: Lean.Json → ExceptT String (ReaderT Lean.Server.RpcObjectStore Id) Lean.Widget.PanelWidgetInstance

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.instRpcEncodablePanelWidgetInstance.enc._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4162
code: Server.RpcEncodable
goal: Lean.Widget.PanelWidgetInstance → StateM Lean.Server.RpcObjectStore Lean.Json

full_name: Lean.Widget.Lean.Widget.PanelWidgetInstance.instFromJsonRpcEncodablePacket
code: Server.RpcEncodable
goal: Lean.FromJson Lean.Widget.Lean.Widget.PanelWidgetInstance.RpcEncodablePacket✝

full_name: Lean.Widget.GetWidgetsResponse
code: /-- Output of `getWidgets` RPC.-/
structure GetWidgetsResponse where
  widgets : Array PanelWidgetInstance
  deriving Server.RpcEncodable
goal: Type

full_name: Lean.Widget.GetWidgetsResponse.widgets
code: /-- Output of `getWidgets` RPC.-/
structure GetWidgetsResponse where
  widgets : Array PanelWidgetInstance
  deriving Server.RpcEncodable
goal: Array Lean.Widget.PanelWidgetInstance

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.instRpcEncodableGetWidgetsResponse.dec._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4960
code: Server.RpcEncodable
goal: Lean.Json → ExceptT String (ReaderT Lean.Server.RpcObjectStore Id) Lean.Widget.GetWidgetsResponse

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.instRpcEncodableGetWidgetsResponse.enc._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4960
code: Server.RpcEncodable
goal: Lean.Widget.GetWidgetsResponse → StateM Lean.Server.RpcObjectStore Lean.Json

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.RpcEncodablePacket._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.4960
code: Server.RpcEncodable
goal: Type

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.instFromJsonRpcEncodablePacket
code: Server.RpcEncodable
goal: Lean.FromJson Lean.Widget.Lean.Widget.GetWidgetsResponse.RpcEncodablePacket✝

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.instRpcEncodableGetWidgetsResponse
code: Server.RpcEncodable
goal: Lean.Server.RpcEncodable Lean.Widget.GetWidgetsResponse

full_name: Lean.Widget.Lean.Widget.GetWidgetsResponse.instToJsonRpcEncodablePacket
code: Server.RpcEncodable
goal: Lean.ToJson Lean.Widget.Lean.Widget.GetWidgetsResponse.RpcEncodablePacket✝

full_name: Lean.Widget.getWidgets
code: /-- Get the panel widgets present around a particular position. -/
def getWidgets (pos : Lean.Lsp.Position) : RequestM (RequestTask (GetWidgetsResponse)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Widget.GetWidgetsResponse)

full_name: Lean.Widget.initFn._@..lake.packages.lean4.src.lean.Lean.Widget.UserWidget._hyg.5595
code: builtin_initialize
  Server.registerBuiltinRpcProcedure ``getWidgets _ _ getWidgets
goal: IO Unit