Fork me on GitHub
#cider
<
2023-09-20
>
lilactown17:09:36

myself and another user of #CRRJBCX7S have noticed with the latest CIDER that indentation after hitting a new line/making a structural update seems to have changed. Previous default indentation (expected, desired)

($ some-symbol
   {:A 1 :B 2}
   foo
   bar)
Current default indentation (undesired):
($ some-symbol
  {:A 1 :B 2}
  foo
  bar)

vemv17:09:28

I assume $ is a macro. Could you please indicate its source?

vemv18:09:15

cider-nrepl probably inferred that it has a :style/indent of 1 given that arglist It a value of 0 (or :form, or :defn) would produce the desired indentation, please declare it, as usual https://docs.cider.mx/cider/indent_spec.html#overview (inference is new - see the last section)

vemv18:09:35

Nice. Tbh, checking out https://github.com/lilactown/helix/blob/master/docs/creating-elements.md#-macro it seems that the produced indentation is exactly what is considered idiomatic (at least in these circles) In the example from that .md, these lines:

($ my-component ($ "div" "first")
                ($ "div" "second"
Seem badly indented to me, since it makes one believe that $ is a vanilla defn, while it is in fact a macro.

lilactown18:09:45

it's only a macro for performance reasons; semantically it is a function that takes data and returns data

vemv18:09:18

Got it. Yeah those pop up from time to time :)

lilactown16:10:42

revisiting this, I am not finding that CIDER is picking up the right indentation even when I set the style/indent metadata. Please let me know if I'm doing something wrong https://github.com/lilactown/helix/pull/148/files

lilactown16:10:25

I'm using cider 1.8.0-snapshot from Sep 14, commit 09d72192a4734653ca0b1b4b227c38760880fc63

lilactown17:10:02

just tested with the official 1.8.0 release, same issues

vemv18:10:51

The metadata map goes before the arglist 👀

lilactown18:10:15

aye, I found that out. I fixed every place I think, but still the DOM macros and fnc are not indented correctly

vemv18:10:32

Restart emacs for good measure , if it persists I'll check out the repo/branch

lilactown19:10:16

restarted and it persists

vemv20:10:51

Alright, I'll look into it sometime during the weekend

1