This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-22
Channels
- # announcements (1)
- # beginners (109)
- # boot (2)
- # calva (26)
- # cider (6)
- # circleci (6)
- # cljsrn (3)
- # clojure (77)
- # clojure-dev (5)
- # clojure-europe (28)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (21)
- # clojure-japan (13)
- # clojure-nl (36)
- # clojure-spec (22)
- # clojure-sweden (4)
- # clojure-uk (105)
- # clojurescript (91)
- # community-development (8)
- # cursive (60)
- # datascript (3)
- # datomic (4)
- # emacs (33)
- # fulcro (19)
- # graalvm (38)
- # hoplon (4)
- # instaparse (1)
- # jobs (1)
- # leiningen (22)
- # off-topic (14)
- # pathom (2)
- # perun (4)
- # planck (5)
- # re-frame (10)
- # reagent (1)
- # reitit (11)
- # rum (11)
- # shadow-cljs (97)
- # tools-deps (82)
- # vim (53)
@defndaines btw, for vim, you can enter :ALEInfo to see what Ale has configured for the clj file (and to see which linter is being used, and how it is invoked)
Nice. thanks.
Current Filetype: clojure
Available Linters: ['clj-kondo', 'joker']
Enabled Linters: ['clj-kondo', 'joker']
β¦ so confirms that no need to specifically enable it.(def my-map {:a "A value"
:blarg :another-value
:foo {:test "A nested map"
:c :d}})
(def my-map {:a "A value"
:blarg :another-value
:foo {:test "A nested map"
:c :d}})
I can sorta see it make sense, if you have, for example, a large edn file with lots of sub maps
I used to really dislike the latter because of diffs but I think it is easier to read an zprint can do that for you on vim. So now I use it all the time :man-shrugging::skin-tone-2:
Think you mentioned that you use Conjure or did at some point? I'm planning on adding zprint formatting to Conjure either on a mapping or on file write soon, does it work well for you? (as in, does zprint give you nice output or do you think something else would be better)
So zprint has lots of corner cases that we solve using configuration or skipping some forms. I don't think it can be used without lots of specific configuration. I will try to compile clj-fmt with graalvm (which people have done in the past) and see if it works better out of the box. Formatting macros is a problem in general, so schema.core/defn
, clojure.test/are
, everything that needs tripplets in a single line cannot be formatted with zprint. Also there are some performance issues for forms with lots of nesting, we had a namespace that was taking more than 5 minutes to be formatted and in the end I just put directives to skip most of the forms there.
i will concede that aligning is particularly annoying if there is one key that is way longer than the others
i.e.
{:foo 1
:bar 2
:baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz 3
:quux 4}
vs.
{:foo 1
:bar 2
:baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz 3
:quux 4}
I'm sure you could come up with some rules of variance that are aesthetically pleasing.
one of my rules is that lines should be no longer than 80 characters, always, unless there is a technical reason why that isn't possible (which is rare)
while we're talking about this: i started using Go recently for a hobby project, and i've found myself pleasantly surprised by it in a number of ways
gofmt doesn't format code at all like i would, but the fact of the matter is that i don't have a choice, and that fact is liberating
i realize it's inefficient, but clojure doesn't give you any other way to break up long strings across multiple lines
My rule for formatting is that it has to be automatic and automatic across the team β¦ so if someone wants a particular format, they have to provide everyone (vim, emacs, Cursive, etc.) with the tools that donβt force anyone to have to think about it.
right, and some editors are less customizable than others so formatting for a team, I think, should fall to whatever is easiest across editors.
Or have an editor agnostic approach, like running zprint (or whatever you want) on the files involved in git diffs.