This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-02
Channels
- # announcements (1)
- # babashka (19)
- # beginners (85)
- # calva (1)
- # cider (23)
- # clara (19)
- # clj-kondo (28)
- # clojars (4)
- # clojure (60)
- # clojure-australia (8)
- # clojure-dev (14)
- # clojure-europe (117)
- # clojure-nl (3)
- # clojure-uk (11)
- # clojurescript (68)
- # conjure (2)
- # core-async (39)
- # cryogen (11)
- # cursive (7)
- # data-science (1)
- # datomic (9)
- # emacs (10)
- # etaoin (1)
- # events (1)
- # fulcro (1)
- # helix (10)
- # jobs (4)
- # kaocha (2)
- # keechma (3)
- # leiningen (1)
- # malli (6)
- # pathom (15)
- # pedestal (10)
- # re-frame (5)
- # reitit (1)
- # remote-jobs (1)
- # rum (3)
- # shadow-cljs (18)
- # tools-deps (30)
- # vim (6)
I’ve never investigated this, but I’m interested in this too, it would be good to document.
How far from the https://github.com/bbatsov/clojure-style-guide#the-clojure-style-guide are the Cursive defaults? Not all that far, right? I see some difference in my day job project, but I am not sure what comes from Cursive settings and what is from its defaults (most people here use Cursive).
These are the settings one of my colleagues sent me:
<ClojureCodeStyleSettings>{
:cljs.core/as-> :only-indent
:cljs.core/case :only-indent
:cljs.core/defonce :only-indent
:clojure.core/case 2
:compojure.core/defroutes :only-indent
:cursive.formatting/align-binding-forms true
:cursive.formatting/comment-align-column 0
:garden.def/defstyles :only-indent
}</ClojureCodeStyleSettings>
The main differences I see are that in the existing code base most re-frame (reg-.*
forms and (:require
are indented with 2 spaces, while they have no special treatment by cljfmt
defaults (i.e. they are indented with 1 space).
I seem to make Calva mostly behave together with Cursive on this project using this cjfmt.edn
:
{:remove-surrounding-whitespace? true
:remove-trailing-whitespace? true
:remove-consecutive-blank-lines? false
:insert-missing-whitespace? true
:align-associative? true
:indents {#"^reg-" [[:inner 0]]
#"^:require" [[:block 0]]}}
(Note that align-associative?
isn’t standard cljfmt
, it is just on my fork. And it doesn’t behave nearly as stellar as Cursive’s one.)I’ll let you know if I find out enough about this to provide https://calva.io/formatting/ with a settings example for Cursive defaults compatibility.