cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Add indentation setting to indent to the same level as the previous form

Open danielcompton opened this issue 10 years ago • 1 comments

We're using [clairvoyant] to trace namespaces, and we need to wrap everything in a trace-forms macro. Currently this indents everything one level. It would be great if we could have a Cursive indentation setting to indent to the same level as the previous form.

So

(trace-forms {:tracer (tracer :color "green")}

  (defn filter-fn-for
    [showing-kw]
    (case showing-kw
      :active (complement :done)
      :done :done
      :all identity))
)

is instead indented as

(trace-forms {:tracer (tracer :color "green")}

(defn filter-fn-for
  [showing-kw]
  (case showing-kw
    :active (complement :done)
    :done :done
    :all identity))
)

danielcompton avatar Jul 23 '15 19:07 danielcompton

This is still open in 1.12.4-2022.2 as discussed with @cursive-ide in a slack thread.

There are similar macros out in the wild, https://github.com/cgrand/macrovich is an example. Some devs might prefer their top-level comment blocks to be formatted like this (I sometimes do).

In my experience these special wrapper macros mostly appear as top-level forms, and could be nested:

(def foo :foo)

(wrapper-1

(def bar :bar)

)

(wrapper-2
(wrapper-3

(def baz :baz)

))

imrekoszo avatar Aug 02 '22 10:08 imrekoszo