cider-nrepl
cider-nrepl copied to clipboard
Ability to configure function for formatting code
It would be nice to have the ability to configure the function used for formatting code (i.e cider-format-buffer
).
The relevant repl middleware function: https://github.com/clojure-emacs/cider-nrepl/blob/ce42411c475b9cd486da9722129e601e75e62891/src/cider/nrepl/middleware/format.clj#L12-L16
We'd like to use https://github.com/kkinnear/zprint instead cljfmt.
For pretty printing, configuring the desired library is already supported: https://github.com/clojure-emacs/cider-nrepl/blob/f406dff7b76b7ce6257ab12f0ce009816d60139a/src/cider/nrepl/middleware/pprint.clj#L39-L43
For now, and in case somebody else wants to use zprint with cider, we use the following approach to change reformat-string
:
(alter-var-root
#'cider.nrepl.middleware.format/reformat-string
(constantly (delay #(zprint/zprint-file-str % "<stdin>")))
Is the ability to configure this properly and out of the box, like for pretty printing, something the project would be interested in?
Yeah, certainly.
Ideally this should be done in a way that that doesn't make cider-nrepl
depend directly on several libraries, though.