Skip to content

Instantly share code, notes, and snippets.

@cppio
Created February 6, 2025 21:27
Show Gist options
  • Save cppio/6bc2eea9ca459bcaa19a0fc1678b88f8 to your computer and use it in GitHub Desktop.
Save cppio/6bc2eea9ca459bcaa19a0fc1678b88f8 to your computer and use it in GitHub Desktop.
import Lean.Elab.Command
elab tk:"#show " "macro " i:ident : command => do
let key ← Lean.Elab.Command.liftCoreM do Lean.Elab.realizeGlobalConstNoOverloadWithInfo i
let env ← Lean.getEnv
let names := Lean.Elab.macroAttribute.getEntries env key |>.map (·.declName)
Lean.logInfoAt tk (.joinSep names Lean.Format.line)
elab tk:"#show " "term_elab " i:ident : command => do
let key ← Lean.Elab.Command.liftCoreM do Lean.Elab.realizeGlobalConstNoOverloadWithInfo i
let env ← Lean.getEnv
let names := Lean.Elab.Term.termElabAttribute.getEntries env key |>.map (·.declName)
Lean.logInfoAt tk (.joinSep names Lean.Format.line)
elab tk:"#show " "command_elab " i:ident : command => do
let key ← Lean.Elab.Command.liftCoreM do Lean.Elab.realizeGlobalConstNoOverloadWithInfo i
let env ← Lean.getEnv
let names := Lean.Elab.Command.commandElabAttribute.getEntries env key |>.map (·.declName)
Lean.logInfoAt tk (.joinSep names Lean.Format.line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment