Zulip Chat Archive
Stream: lean4
Topic: Pretty printing comments
Damiano Testa (Apr 30 2025 at 19:15):
Given how well my previous pretty comment went, let me try again, this time with pretty-printing comments.
Should this also be modified?
import Lean.Elab.Command
open Lean Elab.Command in
elab "#pretty_print " cmd:command : command => do
elabCommand cmd -- it is too weird if you do not elaborate the command!
logInfo cmd
/--
info: variable (a : Nat) in
-- here is a simple exampleexample : a = a :=
rfl
-/
#guard_msgs in
#pretty_print
variable (a : Nat) in
-- here is a simple example
example : a = a := rfl
Jannis Limperg (Apr 30 2025 at 19:22):
This is a long-standing issue: lean4#3791
Damiano Testa (Apr 30 2025 at 19:22):
Ah, yes, thanks for the link!
Damiano Testa (Apr 30 2025 at 19:23):
I had already upvoted it. I wish I could upvote it again, given that I had forgotten about it...
Damiano Testa (Apr 30 2025 at 19:25):
In case anyone wonders about where these pretty comment come from, it is thanks to the linter at #24465: it exploits the pretty printer as a source of how to format code, and has picked up a few pretty printing issues.
Damiano Testa (Apr 30 2025 at 19:25):
Come to think of it, Jannis, any chance that this looks reasonable to you? leanprover-community/aesop#203
Last updated: May 02 2025 at 03:31 UTC