Zulip Chat Archive

Stream: lean4

Topic: Code style/formatting


Tom (Jul 18 2022 at 17:46):

All the examples and library code that I've seen use a very specific code style. As a VSCode user, is there a way I can autoformat my code to follow the same style (similar to clang-format/black/etc for other languages)? I've not been able to find anything in the Lean 4 extension or any relevant posts on this forum.
Thanks!

Henrik Böving (Jul 18 2022 at 17:48):

We don't have auto formatting yet, there are plans to get there but nothing working right now.

Paige Thomas (Nov 10 2024 at 01:53):

I was just wondering if there is anything available now for this, or possibly in the works?

Damiano Testa (Nov 10 2024 at 02:48):

There is a linter, linter.ppRoundtrip, that tries to approximate this. It works for minor issues, but it is filled with false positives and negatives. Moreover, even the rountripping part is not guaranteed.

Paige Thomas (Nov 10 2024 at 02:52):

I was thinking more along the lines of a program that changes the source code formatting based on options that you pass it.


Last updated: May 02 2025 at 03:31 UTC