Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make everything inner, but keep multi-arity alignment #85

Open
wilkerlucio opened this issue Jan 17, 2022 · 1 comment
Open

Make everything inner, but keep multi-arity alignment #85

wilkerlucio opened this issue Jan 17, 2022 · 1 comment
Labels

Comments

@wilkerlucio
Copy link
Contributor

Hello, in my configurations of cljstyle I would like for most things to use [[:ident 0]] format, so the basics would start like:

{:rules
 {:indentation
  {:indents
   {#".*" [[:inner 0]]}}}}

The issue I have is after doing this, a multi-arity fn starts to get indent in a weird way:

; before changing config, this is the indentation:
(defn multi-arity
  ([] (multi-arity {}))
  ([arg]
   ; here, body aligns with args
   (do-stuff)))

; after the config it turns into this:
(defn multi-arity
  ([] (multi-arity {}))
  ([arg]
    ; after the change cljstyle adds one more space here
    (do-stuff)))

Is there a way to keep the wildcard but still use a single space in the case of multi-arity fn?

@eneroth
Copy link

eneroth commented Feb 21, 2022

Hi Wilker,

I'm experimenting with this config, which seems to achieve what you're looking for:

{:rules
 {:whitespace  {:remove-surrounding? true
                :remove-trailing?    true
                :insert-missing?     true}
  :indentation {:indents {#"^:?require$" [[:inner 0]]
                          #"^:?import$"  [[:inner 0]]
                          #"^:?use$"     [[:inner 0]]
                          #"^[^ \[]"     [[:inner 0]]
                          or             [[:block 0]]
                          and            [[:block 0]]
                          do             [[:block 0]]}}
  :vars        {:enabled? false}
  :namespaces  {:enabled? false}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants