cider-nrepl icon indicating copy to clipboard operation
cider-nrepl copied to clipboard

Observe .cljfmt.edn files

Open vemv opened this issue 2 years ago • 3 comments

Soft of a draft, does it look good to you? @yuhan0 @bbatsov

Before submitting a PR make sure the following things have been done:

  • [ ] The commits are consistent with our contribution guidelines
  • [ ] You've added tests to cover your change(s)
  • [ ] All tests are passing
  • [ ] The new code is not generating reflection warnings
  • [ ] You've updated the README (if adding/changing middleware)

Note: If you're just starting out to hack on cider-nrepl you might find nREPL's documentation and the "Design" section of the README extremely useful.*

Thanks!

vemv avatar Jun 01 '22 13:06 vemv

Also just wondering if this should be designed in mind for extensibility to other formatting backends in the future, similar to the pprint middleware - eg. the more opinionated zprint or a hypothetical "Tonsky formatter".

Zprint for instance already recognizes its own .zprintrc files, so passing an additional key for config-file could be confusing.

yuhan0 avatar Jun 02 '22 04:06 yuhan0

I agree that it'd be better to support both zprint and cljfmt as formatting backends, but I don't feel strongly about this.

Sorry that I had completely forgotten about this PR!

bbatsov avatar Aug 24 '22 06:08 bbatsov

Me too :) will get back at it soon.

vemv avatar Aug 24 '22 07:08 vemv

Getting back into this soon...

as a note to self, besides from supporting cider-format, observing .cljfmt.edn would be interesting for dynamically generating :style/indent values. This would elliminate any discrepancies between clojure-mode and cider-format's results.

(maybe useful: https://github.com/clojure-lsp/clojure-lsp/pull/1471)

vemv avatar Aug 16 '23 06:08 vemv

I'm reworking this, will look quite different.

vemv avatar Jan 15 '24 11:01 vemv

Did this get abandoned?

I found this issue from https://clojurians.slack.com/archives/C099W16KZ/p1692166428844959?thread_ts=1692163238.351989&cid=C099W16KZ

I'm having the same issue -- lsp-format-buffer works differently from when I just press <return> or <tab> in a clojure file. It would be really great if there was a way to have consistent formatting.

aiba avatar Apr 03 '24 02:04 aiba

@aiba sorry - Gmail buried this.

I actually have a newer cljfmt branch which might see the light of day around the next stable CIDER release.

vemv avatar May 07 '24 13:05 vemv