Fork me on GitHub

I have a clj + cljs project with both a Leiningen project.clj for the backend code and a shadow-cljs.edn for the frontend. I exported a pom.xml using shadow-cljs, but importing that seems to break dependency resolution using Leiningen since a module can only be managed by one build tool at a time. Is there a workaround for this besides integrating shadow-cljs with Lein completely?


Both the project.clj and the shadow-cljs.edn are sitting in the same project root.


If moving the Lein project to use deps will help, I’m open to exploring that.


@jysandy probably best to configure your CLJS dependencies in project.clj and then make shadow-cljs use that too. less of a hassle overall to just have one place to declare dependencies. if you don't mind copying you can also just copy your CLJS dependencies to project.clj under the :dev profile or so that Cursive can find it but still actually use shadow-cljs.edn for CLJS deps


there seems to a bug with the way cursive evaluates calls to clojure.core/pr and clojure.core/print. i used a few expressions to compare the behavior of cursive's repl client to that of clojure's built-in repl client. both clients are connected to the same clojure socket repl server. the results are shown in the following screenshots. is there any github issue tracking this bug?


pr and print don't force a flush


you may be observing some independent difference in when the output stream is flushed


Actually I based Cursive’s socket REPL code on prepl, and prepl has the same bug:

~> telnet 5555
Connected to localhost.
Escape character is '^]'.
(+ 1 2)
{:tag :ret, :val "3", :ns "user", :ms 17, :form "(+ 1 2)"}
(pr 1 2 3)
{:tag :ret, :val "nil", :ns "user", :ms 3, :form "(pr 1 2 3)"}
(prn 1 2 3)
{:tag :out, :val "1 2 31 2 3\n"}
{:tag :ret, :val "nil", :ns "user", :ms 1, :form "(prn 1 2 3)"}


I can’t figure out the right place to fix this for the moment, but I’m looking into it.


(binding [*out* out, *flush-on-newline* true, *print-readably* true]
  (locking lock
    (prn (if (#{:ret :tap} (:tag m))
             (assoc m :val (valf (:val m)))
             (catch Throwable ex
               (assoc m :val (ex->data ex :print-eval-result)
                        :exception true)))


Here, the *flush-on-newline* doesn’t seem to work, even though prn is used.


Actually, I lie, I was getting my streams confused. *out* needs to be flushed before calling out-fn with :tag :ret or :tag :error if any eval might have output anything.


I have this fixed for Cursive.


Thank you very much, Colin! I really appreciate the time you’ve taken out of your busy schedule to fix this. 🙂


No worries, sorry it took so long to get to! I’ll try to get an EAP out with this shortly.

👍 3

yeah, that's what i figured (when the output stream gets flushed) and was a little hesitant to call this a bug. however, i believe, i was bitten by this a few times in some other contexts in the past (i vaguely remember one of them being clojure.test).


ah, after hours of sifting through the clojurians slack log, i finally found what it was. i was wrong, it wasn't clojure.test, it was expound. here is the problem we ran into:


> i'm curious how everybody's experience with using a remote socket repl with cursive is. we've been having problems with this set-up. one particular problem that we had today was that the cursive repl client wouldn't show the output from expound. that is if you evaluate (expound/expound string? 42), all you get in the repl client output is nil. am i missing something?


here is, i believe, how this difference manifests itself as a bug in cursive's repl client:


and that was very confusing back then...