Hi, does anyone know if there is a way in Cider to provide a custom cljfmt formatting configuration?
Custom in what sense? CIDER just runs cljfmt
, so it should pick whatever configuration you have.
Where does cljfmt
read the configuration from?
I’d like to provide the following configuration
:cljfmt {:remove-consecutive-blank-lines? false
:remove-surrounding-whitespace? false
:indents ^:replace {#".*" [[:inner 0]]}}
That's the integration point https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/format.clj#L28
It seem you actually have to pass the configuration to the middleware. I had forgotten how that code looks.
It also seems we didn't expose this through the existing format commands in CIDER.
i see: the cider call would be here, right? https://github.com/clojure-emacs/cider/blob/1be3b89c00d9fe6d2b69e5b719d168e22d333a25/cider-client.el#L714
Yeah, that's the "low-level" request function, most of the user-facing code is in cider-format.el
.
It shouldn't be hard to change this. Probably we can expose the configuration through a defcustom.