File: .lake/packages/lean4/src/lean/Lean/Server/CodeActions/Attr.lean

full_name: Lean.CodeAction.HoleCodeAction
code: /-- A hole code action extension. -/
abbrev HoleCodeAction 
goal: Type

full_name: Lean.CodeAction.mkHoleCodeAction
code: /-- Read a hole code action from a declaration of the right type. -/
def mkHoleCodeAction (n : Name) : ImportM HoleCodeAction 
goal: Lean.ImportM Lean.CodeAction.HoleCodeAction

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.84
code: /-- An extension which collects all the hole code actions. -/
builtin_initialize holeCodeActionExt :
    PersistentEnvExtension Name (Name × HoleCodeAction) (Array Name × Array HoleCodeAction) ←
  registerPersistentEnvExtension {
    mkInitial := pure (#[], #[])
    addImportedFn := fun as => return (#[], ← as.foldlM (init := #[]) fun m as =>
      as.foldlM (init := m) fun m a => return m.push (← mkHoleCodeAction a))
    addEntryFn := fun (s₁, s₂) (n₁, n₂) => (s₁.push n₁, s₂.push n₂)
    exportEntriesFn := (·.1)
  }
goal: IO
  (Lean.PersistentEnvExtension Lean.Name (Lean.Name × Lean.CodeAction.HoleCodeAction)
    (Array Lean.Name × Array Lean.CodeAction.HoleCodeAction))

full_name: Lean.CodeAction.holeCodeActionExt
code: /-- An extension which collects all the hole code actions. -/
builtin_initialize holeCodeActionExt :
    PersistentEnvExtension Name (Name × HoleCodeAction) (Array Name × Array HoleCodeAction) ←
  registerPersistentEnvExtension {
    mkInitial := pure (#[], #[])
    addImportedFn := fun as => return (#[], ← as.foldlM (init := #[]) fun m as =>
      as.foldlM (init := m) fun m a => return m.push (← mkHoleCodeAction a))
    addEntryFn := fun (s₁, s₂) (n₁, n₂) => (s₁.push n₁, s₂.push n₂)
    exportEntriesFn := (·.1)
  }
goal: Lean.PersistentEnvExtension Lean.Name (Lean.Name × Lean.CodeAction.HoleCodeAction)
  (Array Lean.Name × Array Lean.CodeAction.HoleCodeAction)

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.301
code: builtin_initialize
  registerBuiltinAttribute {
    name := `hole_code_action
    descr := "Declare a new hole code action, to appear in the code actions on ?_ and _"
    applicationTime := .afterCompilation
    add := fun decl stx kind => do
      Attribute.Builtin.ensureNoArgs stx
      unless kind == AttributeKind.global do
        throwError "invalid attribute 'hole_code_action', must be global"
      if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
      modifyEnv (holeCodeActionExt.addEntry · (decl, ← mkHoleCodeAction decl))
  }
goal: IO Unit

full_name: Lean.CodeAction.CommandCodeAction
code: /-- A command code action extension. -/
abbrev CommandCodeAction 
goal: Type

full_name: Lean.CodeAction.mkCommandCodeAction
code: /-- Read a command code action from a declaration of the right type. -/
def mkCommandCodeAction (n : Name) : ImportM CommandCodeAction 
goal: Lean.ImportM Lean.CodeAction.CommandCodeAction

full_name: Lean.CodeAction.CommandCodeActionEntry.declName
code: /-- An entry in the command code actions extension, containing the attribute arguments. -/
structure CommandCodeActionEntry where
  /-- The declaration to tag -/
  declName : Name
  /-- The command kinds that this extension supports.
  If empty it is called on all command kinds. -/
  cmdKinds : Array Name
  deriving Inhabited
goal: Lean.Name

full_name: Lean.CodeAction.instInhabitedCommandCodeActionEntry
code: /-- An entry in the command code actions extension, containing the attribute arguments. -/
structure CommandCodeActionEntry where
  /-- The declaration to tag -/
  declName : Name
  /-- The command kinds that this extension supports.
  If empty it is called on all command kinds. -/
  cmdKinds : Array Name
  deriving Inhabited
goal: Inhabited Lean.CodeAction.CommandCodeActionEntry

full_name: Lean.CodeAction.CommandCodeActionEntry.cmdKinds
code: /-- An entry in the command code actions extension, containing the attribute arguments. -/
structure CommandCodeActionEntry where
  /-- The declaration to tag -/
  declName : Name
  /-- The command kinds that this extension supports.
  If empty it is called on all command kinds. -/
  cmdKinds : Array Name
  deriving Inhabited
goal: Array Lean.Name

full_name: Lean.CodeAction.CommandCodeActionEntry
code: /-- An entry in the command code actions extension, containing the attribute arguments. -/
structure CommandCodeActionEntry where
  /-- The declaration to tag -/
  declName : Name
  /-- The command kinds that this extension supports.
  If empty it is called on all command kinds. -/
  cmdKinds : Array Name
  deriving Inhabited
goal: Type

full_name: Lean.CodeAction.instInhabitedCommandCodeActions
code: /-- The state of the command code actions extension. -/
structure CommandCodeActions where
  /-- The list of command code actions to apply on any command. -/
  onAnyCmd : Array CommandCodeAction := {}
  /-- The list of command code actions to apply when a particular command kind is highlighted. -/
  onCmd : NameMap (Array CommandCodeAction) := {}
  deriving Inhabited
goal: Inhabited Lean.CodeAction.CommandCodeActions

full_name: Lean.CodeAction.CommandCodeActions.onAnyCmd
code: /-- The state of the command code actions extension. -/
structure CommandCodeActions where
  /-- The list of command code actions to apply on any command. -/
  onAnyCmd : Array CommandCodeAction := {}
  /-- The list of command code actions to apply when a particular command kind is highlighted. -/
  onCmd : NameMap (Array CommandCodeAction) := {}
  deriving Inhabited
goal: Array Lean.CodeAction.CommandCodeAction

full_name: Lean.CodeAction.CommandCodeActions
code: /-- The state of the command code actions extension. -/
structure CommandCodeActions where
  /-- The list of command code actions to apply on any command. -/
  onAnyCmd : Array CommandCodeAction := {}
  /-- The list of command code actions to apply when a particular command kind is highlighted. -/
  onCmd : NameMap (Array CommandCodeAction) := {}
  deriving Inhabited
goal: Type

full_name: Lean.CodeAction.CommandCodeActions.onCmd
code: /-- The state of the command code actions extension. -/
structure CommandCodeActions where
  /-- The list of command code actions to apply on any command. -/
  onAnyCmd : Array CommandCodeAction := {}
  /-- The list of command code actions to apply when a particular command kind is highlighted. -/
  onCmd : NameMap (Array CommandCodeAction) := {}
  deriving Inhabited
goal: Lean.NameMap (Array Lean.CodeAction.CommandCodeAction)

full_name: Lean.CodeAction.CommandCodeActions.insert
code: /-- Insert a command code action entry into the `CommandCodeActions` structure. -/
def CommandCodeActions.insert (self : CommandCodeActions)
    (tacticKinds : Array Name) (action : CommandCodeAction) : CommandCodeActions 
goal: Lean.CodeAction.CommandCodeActions

full_name: Lean.CodeAction.builtinCmdCodeActions
code: builtin_initialize builtinCmdCodeActions : IO.Ref CommandCodeActions ← IO.mkRef {}
goal: IO.Ref Lean.CodeAction.CommandCodeActions

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.762
code: builtin_initialize builtinCmdCodeActions : IO.Ref CommandCodeActions ← IO.mkRef {}
goal: IO (IO.Ref Lean.CodeAction.CommandCodeActions)

full_name: Lean.CodeAction.insertBuiltin
code: def insertBuiltin (args : Array Name) (proc : CommandCodeAction) : IO Unit 
goal: IO Unit

full_name: Lean.CodeAction.cmdCodeActionExt
code: /-- An extension which collects all the command code actions. -/
builtin_initialize cmdCodeActionExt :
    PersistentEnvExtension CommandCodeActionEntry (CommandCodeActionEntry × CommandCodeAction)
      (Array CommandCodeActionEntry × CommandCodeActions) ←
  registerPersistentEnvExtension {
    mkInitial := return (#[], ← builtinCmdCodeActions.get)
    addImportedFn := fun as => do
      let init ← builtinCmdCodeActions.get
      return (#[], ← as.foldlM (init := init) fun m as =>
      as.foldlM (init := m) fun m ⟨name, kinds⟩ =>
        return m.insert kinds (← mkCommandCodeAction name))
    addEntryFn := fun (s₁, s₂) (e, n₂) => (s₁.push e, s₂.insert e.cmdKinds n₂)
    exportEntriesFn := (·.1)
  }
goal: Lean.PersistentEnvExtension Lean.CodeAction.CommandCodeActionEntry
  (Lean.CodeAction.CommandCodeActionEntry × Lean.CodeAction.CommandCodeAction)
  (Array Lean.CodeAction.CommandCodeActionEntry × Lean.CodeAction.CommandCodeActions)

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.819
code: /-- An extension which collects all the command code actions. -/
builtin_initialize cmdCodeActionExt :
    PersistentEnvExtension CommandCodeActionEntry (CommandCodeActionEntry × CommandCodeAction)
      (Array CommandCodeActionEntry × CommandCodeActions) ←
  registerPersistentEnvExtension {
    mkInitial := return (#[], ← builtinCmdCodeActions.get)
    addImportedFn := fun as => do
      let init ← builtinCmdCodeActions.get
      return (#[], ← as.foldlM (init := init) fun m as =>
      as.foldlM (init := m) fun m ⟨name, kinds⟩ =>
        return m.insert kinds (← mkCommandCodeAction name))
    addEntryFn := fun (s₁, s₂) (e, n₂) => (s₁.push e, s₂.insert e.cmdKinds n₂)
    exportEntriesFn := (·.1)
  }
goal: IO
  (Lean.PersistentEnvExtension Lean.CodeAction.CommandCodeActionEntry
    (Lean.CodeAction.CommandCodeActionEntry × Lean.CodeAction.CommandCodeAction)
    (Array Lean.CodeAction.CommandCodeActionEntry × Lean.CodeAction.CommandCodeActions))

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.1080
code: builtin_initialize
  registerBuiltinAttribute {
    name := `command_code_action
    descr := "Declare a new command code action, to appear in the code actions on commands"
    applicationTime := .afterCompilation
    add := fun decl stx kind => do
      unless kind == AttributeKind.global do
        throwError "invalid attribute 'command_code_action', must be global"
      let `(attr| command_code_action $args*) := stx | return
      let args ← args.mapM realizeGlobalConstNoOverloadWithInfo
      if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
      modifyEnv (cmdCodeActionExt.addEntry · (⟨decl, args⟩, ← mkCommandCodeAction decl))
  }
goal: IO Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Server.CodeActions.Attr.0.Lean.CodeAction.addBuiltin
code: private def addBuiltin (declName : Name) (args : Array Name) : AttrM Unit 
goal: Lean.AttrM Unit

full_name: Lean.CodeAction.initFn._@..lake.packages.lean4.src.lean.Lean.Server.CodeActions.Attr._hyg.1473
code: builtin_initialize
  registerBuiltinAttribute {
    ref             := by exact decl_name%
    name            := `builtin_command_code_action
    descr           := "Declare a new builtin command code action, to appear in the code actions on commands"
    applicationTime := .afterCompilation
    add             := fun decl stx kind => do
      unless kind == AttributeKind.global do
        throwError "invalid attribute 'command_code_action', must be global"
      let `(attr| builtin_command_code_action $args*) := stx |
        throwError "unexpected 'command_code_action' attribute syntax"
      let args ← args.mapM realizeGlobalConstNoOverloadWithInfo
      if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
      addBuiltin decl args
  }
goal: IO Unit