day8 / re-frame-10x

A debugging dashboard for re-frame. X-ray vision as tooling.
MIT License
631 stars 68 forks source link

Indentation not available for `fn-traced` forms #267

Closed stumitchell closed 1 year ago

stumitchell commented 4 years ago

The following code is not indented

(re-frame/reg-event-db
 ::let
 (fn-traced [db _]
   (let [a 10
         b (+ a 20)]
     (+ a b)
     db)))

image

danielcompton commented 4 years ago

I'm 95% sure that that information isn't available in the macroexpansion, you only get the parsed s-expression data. I think you'd need to use a Clojure formatter to reformat this to something reasonable.

mike-thompson-day8 commented 4 years ago

@danielcompton Yes, understood. We created this issue to remind us that the reformatting is not working on this code. Perhaps because it is too simple. Anyway, more investigation needed.

Perhaps we should move to use a different (better?) code reformatter. For example, Calva uses cljfmt

danielcompton commented 4 years ago

I don't think cljfmt will break the lines for you given the data. I haven't investigated deeply, but possibly something like https://github.com/greglook/cljstyle or https://github.com/nedap/formatting-stack might be able to reform code from data.

kimo-k commented 1 year ago

"Can't repro with the provided function. Zprint is working as intended on my local build. I checked on both 1.7.0 and 1.6.0.

It is interesting that you'd get this result, since we've been formatting this code with zprint since at least 2018. Zprint won't reproduce the exact linebreaks in your code, but it does format your example reasonably, spreading it over 4 lines.

Closing for now.