@caumond Using LSP the variable lsp-enable-on-type-formatting t
will format while typing as ag mentioned, use a clojure-mode hook to add aggressive-indent-mode (add-hook 'clojure-mode-hook #'aggressive-indent-mode)
Do not use both of these together unless you want to see Emacs will go crazy :)
e.g I have the following rules in project.clj
and I want aggressive-indent
to use it I format the code via indent-region
:cljfmt
{:remove-surrounding-whitespace? true
:remove-trailing-whitespace? true
:remove-consecutive-blank-lines? true
:insert-missing-whitespace? true
:align-associative? false
:split-keypairs-over-multiple-lines? true
:remove-multiple-non-indenting-spaces? true
:indents {async [[:inner 0]]}}
I haven't found a way to make aggressive-indent work with LSP format as you type. It seems to be one or the other. When cljfmt supports aligning of argument forms, then aggressive-indent shouldn't be needed.
There is an issue around this on cljfmt and @lee is kindly looking at ways to add this feature
@agilecreativity the hereβs https://github.com/weavejester/cljfmt/issues/36 and there has been some discussion in #cljfmt too. Input and ideas are welcome.
If aggressive-indent-mode
could be configurable to the degree that it would match cljfmt or the nrepl-middleware that cider et al use to format code, it would help allow people (me) to continue using it in the context of a larger project with other people who aren't using aggressive-indent-mode
I personally love aggressive-indent-mode
but if not everybody on the team is using it, and the various formatting tools disagree about how to format the code, the result is so expensive that I feel like I have to accept that I cannot have my preference
I want the same thing and I really like aggressive-indent-mode
and wish I can customize it to make it produce the same output as cljfmt
so the same rules can be used with other team member.
That's it, aggressive indent mode
thank you very much !