gregsh / Clojure-Kit

Clojure/ClojureScript plugin for IntelliJ-based IDEs
Other
248 stars 21 forks source link

Indentation is inconsistent with style guide #6

Closed dancmeyers closed 7 years ago

dancmeyers commented 7 years ago

We're following this community style guide, which seems to be referenced in various places and generally accepted as the standard: https://github.com/bbatsov/clojure-style-guide

As per https://github.com/bbatsov/clojure-style-guide#body-indentation, we were expecting if, when, when-not etc to indent 2 spaces, i.e.

(if (condition-fn variable)
  (true-fn)
  (false-fn))

(when (condition-fn variable)
  (true-fn))

(when-not (condition-fn variable)
  (true-fn))

but macro arguments should vertically align, i.e.

(-> foo
    bar
    baz
    gzork)

(->> foo
     bar
     baz
     gzork)

What Clojure-Kit actually seems to do is vertically align in all cases, so you end up with

(when-not (condition-fn variable)
          (true-fn))

I've had a look at the Clojure-Kit source, but thus far haven't managed to work out where to change this/submit a pull request. I know it's possible, because Cursive follows the documented style (I think it may even have an option to switch between whichever you prefer).

Is it possible to modify the indentation style Clojure-Kit is using, or add an option to switch between them?

gregsh commented 7 years ago

Thanks, it's a good idea.

Current formatter is just a first-pass naïve implementation of something that tries to imitate the real thing with almost no configurable options whatsoever.