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

Support for vertical alignment? #47

Open
robhanlon22 opened this issue May 14, 2020 · 8 comments
Open

Support for vertical alignment? #47

robhanlon22 opened this issue May 14, 2020 · 8 comments

Comments

@robhanlon22
Copy link
Contributor

Clojure Mode for Emacs supports vertical alignment, as does Calva's formatter. Any thoughts on what it might take to add this to cljstyle?

@robhanlon22
Copy link
Contributor Author

Looks like cljfmt has had a WIP PR open for a while for this: weavejester/cljfmt#77

@mpenet
Copy link

mpenet commented May 19, 2020

I personally would like that to be doable both ways if possible (via config), turn a vertical style code base into "normal" alignement or the inverse.

@greglook
Copy link
Owner

This does seem like it would be a good optional feature. You would need to write a formatting rule that looks for maps and various kinds of bindings with alternating pairs, then figure out how much whitespace needed to be between each binding to align with the longest one.

@robhanlon22
Copy link
Contributor Author

Excellent. Here's the prior art:

@robhanlon22
Copy link
Contributor Author

I'll take a stab at this when I have some time.

@robhanlon22
Copy link
Contributor Author

Just kidding, @dparis is going to take a stab at it. I know this because I work with him. You're on the hook now, buddy.

@dparis
Copy link

dparis commented Jun 1, 2020

Update: I've gotten a first pass implementation up on my fork https://github.com/dparis/cljstyle/pull/1/files

There are a few known cases that aren't working that I still need to fix, and I'd like to do a code quality pass, but overall seems to work decently. I'll submit a PR against upstream once those things are sorted out.

@felipetanios
Copy link

Hi guys, i was just trying enable this in cljstyle and bumped in this issue and there is a help-needed label, is there a way to help in this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants