Fork me on GitHub
#shadow-cljs
<
2024-02-25
>
aiba14:02:51

I'm trying to debug why on emacs+cider+nrepl+shadow-cljs repl, evaluating an expression whose result contains any tagged literal (anywhere in the output), somehow this prevents the result from being pretty-printed. (For example, {:a 1} pretty-prints, but {:a #js {}} does not pretty-print. Does anyone familiar with the shadow-cljs code happen to know if or why the presence of a tagged literal in the repl output could prevent the pretty-printing of the repl result?

aiba15:02:26

Shout out to @U45T93RA6 for pointing me at this file!

🙌 1
thheller15:02:19

FWIW shadow-cljs has :devtools {:repl-pprint true} which directly pprints in the runtime, instead of going the cider pr-str, read-string, pprint in nrepl middleware route

vemv16:02:05

The cider-nrepl middleware route is worth supporting, given that it has multiple configurable printers https://github.com/clojure-emacs/cider-nrepl/blob/3824d72f9ba1a14f9ce9910500db0885f6b39c23/src/cider/nrepl/pprint.clj#L41-L81 Not sure if those have ever worked with Shadow / if they will start working now.

aiba20:02:17

I've had :repl-pprint true forever, that setting doesn't seem to avoid the read-string issue fixed by #1174.

aiba20:02:29

And I agree with @U45T93RA6 that it's really nice to be able to specify the pprinting with the emacs config cider-print-fn. With #1174, that's working with my cljs repl now. (I happen to like puget for dev pretty-printing)

vemv20:02:48

Thanks for confirming that - it's great that things like puget also started working here 🎉

aiba20:02:22

Anyway, I'm very happy with this dev setup! (shadow-cljs, cider, & emacs). I've been evaluating clojurescript code with cider-pprint-eval-last-sexp all afternoon and it's pretty-printing like a charm 🙂

âš¡ 1
James Amberger18:02:28

I would like to do this:

(shadow.cljs.devtools.api/watch
      :app
      {:closure-defines
       {'littlereader.anki/url ""}})
i.e. run watch from clojure rather than the shell and pass a closure-define. What I have above doesn’t seem to do it. Is it possible?

thheller20:02:52

(shadow.cljs.devtools.api/watch
  :app
  {:config-merge
   [{:closure-defines
     {'littlereader.anki/url ""}}]})

gratitude-thank-you 1