cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
590 stars 7 forks source link

Incorrect indentation for `if` #1979

Open sooheon opened 6 years ago

sooheon commented 6 years ago

When nested inside some other forms, the if macro indents strangely:

Correct:

(if (zero? rpc)
  80
  rpc)

Incorrect:

(assoc m
  :bid (if (zero? rpc)
           80
           rpc))

Desired:

(assoc m
  :bid (if (zero? rpc)
         80
         rpc))

I am on cursive 1.7.0 EAP 2 2018.1.

To reproduce, enable the following in Preferences / Editor > Code Style > Clojure:

screen shot 2018-04-12 at 5 38 28 pm screen shot 2018-04-12 at 5 38 32 pm
sooheon commented 6 years ago

This is definitely related to nesting forms under assoc.

Other reproductions:

(assoc m
  :foo (when (bar? m)
             (baz m))
  :bar (if-not (bar? m)
               (baz m)
               (quux m)))

And if-not has red inspection error squiggly under it, claiming "Incorrect arity 4 for clojure.core/if-not", when there are clearly 3 arguments.