cursive

Issues at: https://git.io/cursive-issues
cfleming 2020-08-11T00:58:31.136600Z

It’s not, no. Can you give more details about what you’re seeing, or perhaps a screenshot?

jysandy 2020-08-11T07:03:14.138300Z

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?

jysandy 2020-08-11T07:04:00.138800Z

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

jysandy 2020-08-11T07:07:52.139300Z

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

thheller 2020-08-11T09:09:26.141800Z

@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

1
salam 2020-08-11T18:09:37.147900Z

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?

alexmiller 2020-08-11T18:21:04.149600Z

pr and print don't force a flush

alexmiller 2020-08-11T18:22:05.150400Z

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

cfleming 2020-08-18T03:15:30.103700Z

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

~> telnet 127.0.0.1 5555
Trying 127.0.0.1...
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)"}

cfleming 2020-08-18T03:15:52.104Z

@alexmiller @abdusalam ^^

cfleming 2020-08-18T03:17:11.104200Z

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

cfleming 2020-08-18T03:17:17.104400Z

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

cfleming 2020-08-18T03:17:48.104600Z

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

cfleming 2020-08-18T03:35:48.104800Z

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.

cfleming 2020-08-18T03:35:59.105Z

I have this fixed for Cursive.

salam 2020-08-18T04:10:12.107200Z

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

cfleming 2020-08-18T05:23:24.107500Z

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

👍 1
salam 2020-08-11T18:38:10.156300Z

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).

salam 2020-08-11T20:23:17.158900Z

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: https://clojurians-log.clojureverse.org/cursive/2020-06-09/1591730202.130400

salam 2020-08-11T20:24:05.159200Z

> 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?

salam 2020-08-11T20:33:48.160Z

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

salam 2020-08-11T20:34:40.160800Z

and that was very confusing back then...