Skip to content

Rationale for not aligning map values/let bindings #174

Description

@jacobobryant

(Continuing from #173 in a new issue)

I asked you at the conj about map value alignment and you said it could be done but you weren't planning to implement it. Also the readme says:

  • vertical alignment of let forms and map literals are allowed
    • the choice is up to the author
    • [cljfmt option] :remove-multiple-non-indenting-spaces? = false
    • I have seen too many code examples where vertical alignment adds clarity

i.e. the formatter allows alignment, but it doesn't enforce alignment. SCS allows this snippet to go through formatting unchanged, for example:

{:first-key  1
 :second-key 2
 :third-key 3}

This is the other large benefit I've had from zprint. Most of the other Clojure devs in my company have used Cursive with settings enabled for aligning map values (don't remember about let bindings/don't know if Cursive supports that). However I use Vim, which doesn't have any reliable plugin support for doing that. So either I align the values manually (a constant source of friction), or we end up with maps that have partially aligned values (very ugly). zprint's been great since I can just let it do the alignment for me via pre-commit.

So similar to the other issue--obviously I'd love it if you'd be open to implementing map value/let binding alignment, but if not, I'd appreciate an expanded rationale + recommendations for what we should be doing. Should we just allow partially-aligned maps into the codebase? Should we have everyone disable their auto-align-map-forms settings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions