Hey,
Is there a way to integrate any formatting tool like cljstyle or cljfmt into the IDE, in a way that's reproducible in an isolated CI as well?
Is there another tool people use for this purpose?
We found bliss with: https://tonsky.me/blog/clojurefmt With something like this `.cljfmt.clj`:
^{:reference/url ""}
{:indents {#".*" [[:inner 0]]}}
With this Cursive config:<code_scheme name="Default" version="173">
<ClojureCodeStyleSettings>
<option name="alignBindingForms" value="true" />
<option name="defaultOnlyIndent" value="true" />
<option name="forceOnlyIndent" value="true" />
</ClojureCodeStyleSettings>
</code_scheme>
Our committed config/codestyles/Default.xmlwe made an attempt to integrate https://clojureverse.org/t/introducing-standard-clojure-style/10980 but i can't recall the details why that effort has fizzled.
what i do remember:
1. there were some bugs in the implementation, but those were squashed quickly
2. i didn't quite like that fact that we had to pull in a js env just for the formatting
3. we still had to adjust some of the code, so intellij+cursive doesn't fight with it, e.g., put a smiley at the end of rich-comment blocks, so the trailing paren is not "slurped" up to the last sexp in the comment form, iirc
(comment
(some code)
:-)
but we should really solve this once and for all, because now the AI agents keep "mis-formatting" our code too... facepalmalso, if u want to rely on some external formatter, the cursor position might not be maintained. in emacs, there is a package to circumvent this problem https://github.com/radian-software/apheleia (but i still haven't tried it)
there are a few workarounds but this would be the right solution: https://github.com/cursive-ide/cursive/issues/1403. please vote.
@evg.tso I use 'Actions on save'. It works pretty fine.