cljfmt icon indicating copy to clipboard operation
cljfmt copied to clipboard

keyword in destructuring forced to be smashed against bracket

Open MicahElliott opened this issue 2 years ago • 2 comments

This is what cljfmt wants:

(defn foo
  [{:keys [aa
           ;; bb
           ]:as context} ; whitespace problem here

But obviously a space is wanted before the :as.

This is an important problem because it's common that a map key (eg, bb) is no longer used but should still be listed since a future developer want to see that bb is/was indeed a usable piece of the inputs.

MicahElliott avatar Feb 02 '22 19:02 MicahElliott

Can you provide the "before" code as well?

weavejester avatar Feb 03 '22 00:02 weavejester

I can reproduce this with default options:

(defn foo
  [{:keys [aa
           ;; bb
           ] :as context}]
   (foobar))

(defn foo
  [{:keys [aa
           ] :as context}]
   (foobar))

formats to:

(defn foo
      [{:keys [aa
           ;; bb
               ]:as context}]
      (foobar))

(defn foo
      [{:keys [aa] :as context}]
      (foobar))

or avatar May 10 '22 08:05 or