Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to format Clojure code using the pretty printer #1843

Closed
PEZ opened this issue Aug 27, 2022 · 0 comments
Closed

Make it possible to format Clojure code using the pretty printer #1843

PEZ opened this issue Aug 27, 2022 · 0 comments
Labels
formatting pprint Pretty printing issues ux User experience related

Comments

@PEZ
Copy link
Collaborator

PEZ commented Aug 27, 2022

Questions like this show up now and then: https://ask.clojure.org/index.php/12126/there-way-place-elements-collection-vertically-with-calva

TL;DR: Can Calva break up forms, adding new lines?

It can't. A crude (and often insufficient) workaround is to evaluate the form and get it pretty printed.

However, one of Calva's pretty printing options is built in to Calva and is happening client side (using zprint). We could use this to help format code/forms without evaluating it.

I see two main ways we could do this:

  1. Make it possible to use zprint in addition to cljfmt as the Calva formatter
  2. Add a command or two for pretty print-formatting the current form/selection/file

The former has been my ”plan” for very long, but it is not super easy to achieve. In fact it seems pretty hard to do it. The latter is probably not very hard. We have all the needed components, and just need to compose them a bit.

@PEZ PEZ added pprint Pretty printing issues formatting ux User experience related labels Aug 27, 2022
PEZ added a commit that referenced this issue Sep 14, 2022
@PEZ PEZ mentioned this issue Sep 14, 2022
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatting pprint Pretty printing issues ux User experience related
Projects
None yet
Development

No branches or pull requests

1 participant