Fork me on GitHub
#emacs
<
2021-06-02
>
practicalli-johnny10:06:54

@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 :)

Burin22:06:38

Hi @jr0cket Is it possible to make aggressive-indent play well with cljfmt with specific rules in the profiles? It seems aggressive-ident ignore these rules used by cljfmt (e.g. in project.clj for example. Is there ways to make this work together?

Burin22:06:23

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]]}}

practicalli-johnny00:06:13

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.

practicalli-johnny00:06:12

There is an issue around this on cljfmt and @UE21H2HHD is kindly looking at ways to add this feature

👍 6
lread11:06:14

@U39K1NXHP the here’s https://github.com/weavejester/cljfmt/issues/36 and there has been some discussion in #cljfmt too. Input and ideas are welcome.

👍 3
blak3mill3r00:06:55

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

👍 2
blak3mill3r00:06:06

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

👍 3
Burin16:06:00

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.

caumond11:06:19

That's it, aggressive indent mode

caumond11:06:55

thank you very much !

Burin22:06:38

Hi @jr0cket Is it possible to make aggressive-indent play well with cljfmt with specific rules in the profiles? It seems aggressive-ident ignore these rules used by cljfmt (e.g. in project.clj for example. Is there ways to make this work together?