Fork me on GitHub
#dirac
<
2016-09-18
>
fasiha00:09:23

So I have cljs-devtools and Dirac set up and am enjoying REPLing in Dirac instead of Figwheel REPL. But how does one see Cljs code like in Nolen’s https://youtu.be/mty0RwkPmE8?t=24m39s ?

fasiha00:09:45

In my Sources Dirac tab, I only see JS sources?

darwin01:09:17

@fasiha can you confirm that it works in normal (internal) devtools?

fasiha01:09:35

@darwin I've never seen cljs code in Chrome Devtools (even before I installed Dirac/cljs-devtools), is it just supposed to be there under Sources…? (I feel really silly, I'm sure it's something very stupid I'm doing)

fasiha01:09:22

Figwheel puts compiled code in resources/public/js/compiled, and I have a Clojure webserver serving out resources/public as the web root, so all I see in Sources is compiled JS code

fasiha01:09:14

Doh, actually, if I drill down under Sources, I see cljs files, e.g., out/cljs/core.cljs, and they're syntax-highlighted

fasiha01:09:49

And I see my app’s cljs source code too 😄

richiardiandrea02:09:33

A question for cljs-devtools...I see a different output between:

(.info js/console "Calling back!" {:data "a lot of data"}) ;; formatting here is done
and:
(set! cljs.core/*print-fn*
      (fn [& args]
        (apply (.-info js/console) args))) ;; no formatting
Shouldn't I see the same?

darwin11:09:11

@richiardiandrea *print-fn* receives strings from cljs printing subsystem, not original objects. https://github.com/binaryage/cljs-devtools/issues/5#issuecomment-132212643, btw. you should use the enable-console-print! implementation, yours is not 100% correct, because you are calling js/console.info without passing js/console as “this” object

mikethompson14:09:09

@richiardiandrea you'd address the this issue by doing: (apply (js/console.info.bind js/console) args) But, of course, the other issues raised by darwin would need to be addressed first, so this is really only background info.

richiardiandrea16:09:52

@darwin ok, I copied it from the cljs source 😄 I am trying to improve the debug printing in replumb a bit and make it compatible with cljs-devtools, I will follow your and Mike's guidance and report back 😄

richiardiandrea17:09:56

btw I had exactly the same implementation in core.cljs but I thought it was wrong and did not quite read through it...so I guess I will roll my own