cursive

Issues at: https://git.io/cursive-issues
pez 2020-11-02T11:55:57.176200Z

Does anyone know of cljfmt settings that are somewhat compatible with Cursive defaults?

cfleming 2020-11-03T10:23:08.178400Z

I’ve never investigated this, but I’m interested in this too, it would be good to document.

pez 2020-11-03T10:33:32.178600Z

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).

pez 2020-11-03T10:35:55.179Z

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>

pez 2020-11-03T10:40:38.179200Z

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).

pez 2020-11-03T10:46:02.179400Z

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.)

pez 2020-11-03T10:49:57.179600Z

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.