-
Notifications
You must be signed in to change notification settings - Fork 69
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
Prevent clean-ns from putting :as and :refer on their own lines #305
Labels
Comments
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
expez
added a commit
that referenced
this issue
Jun 27, 2021
This makes the ns form take up less vertical space and makes it easier on the eyes. This was never done intentionally but a side-effect of simply delegating the printing of regular libspecs to `clojure.core.pprint` which puts each element of a vector on its own line when the line gets long enough.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is due the default output from
clojure.pprint/pprint
when a vector grows long. It will then put each element on their own line. This looks especially stupid with libspec vectors:[a.pretty.long.ns.gets.its.own.line.like.it.should :as but-then-the-alias-comes-way-down-here]
A better formatting would be:
[a.pretty.long.ns.gets.its.own.line.like.it.should :as the-alias-comes-on-this-line-instead]
I want to give
:refer
the same treatment.[a.pretty.long.ns.gets.its.own.line.like.it.should :refer [this that]
becomes:
[a.pretty.long.ns.gets.its.own.line.like.it.should :refer [this that]
This will, however, cause a bit of a regression if you have a ton of referred symbols:
becomes:
I think these both look super bad. This behavior will privilege short
:refer
clauses, but I think that's fine. Having tons of referred symbols is an anti-pattern anyway, so we should nudge people toward not doing that.If someone does this consistently we can always take another PR improving this edge-case further.
The text was updated successfully, but these errors were encountered: