nrepl/piggieback

”Dirty” cljs-repl clones for plain node

PEZ opened this issue · 2 comments

PEZ commented

If I promote a clj session with this:

  (do
    (require 'cljs.repl.node)
    (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))

And then clone that session, I get a ”dirty” session that won't allow me to evaluate anything. Even something as simple as 1, gives me:

java.lang.NullPointerException
    at cljs.repl.node$node_eval.invokeStatic(node.clj:66)
    at cljs.repl.node$node_eval.invoke(node.clj:60)
    at cljs.repl.node.NodeEnv._evaluate(node.clj:238)
    at user.Delegatingcljs_repl_node_NodeEnv._evaluate(form-init5732710029644372935.clj:66)
    at cljs.repl$evaluate_form.invokeStatic(repl.cljc:569)
    at cljs.repl$evaluate_form.invoke(repl.cljc:499)
    at cider.piggieback$eval_cljs.invokeStatic(piggieback.clj:208)
    at cider.piggieback$eval_cljs.invoke(piggieback.clj:207)
    at cider.piggieback$do_eval$fn__1599.invoke(piggieback.clj:244)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:665)
    at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1973)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1973)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at cider.piggieback$do_eval.invokeStatic(piggieback.clj:221)
    at cider.piggieback$do_eval.invoke(piggieback.clj:220)
    at cider.piggieback$evaluate.invokeStatic(piggieback.clj:267)
    at cider.piggieback$evaluate.invoke(piggieback.clj:265)
    at clojure.lang.Var.invoke(Var.java:384)
    at cider.piggieback$wrap_cljs_repl$fn__1615$fn__1618$fn__1619.invoke(piggieback.clj:299)
    at cider.piggieback$enqueue$fn__1585.invoke(piggieback.clj:191)
    at clojure.lang.AFn.run(AFn.java:22)
    at nrepl.middleware.session$session_exec$main_loop__1022$fn__1026.invoke(session.clj:171)
    at nrepl.middleware.session$session_exec$main_loop__1022.invoke(session.clj:170)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.lang.Thread.run(Thread.java:748)
class java.lang.NullPointerException

This cloning works (afaict) for lein-figwheel, Figwheel Main, and shadow-cljs repls.

The error creates problems in Calva, which for cljs projects clones off the ”original” session and then promotes it to a cljs session (which works fine) and then, for any new cljs sessions it needs, it clones this first promoted session.

This could be slightly related to #93.

Is this a problem just for node or also for nashorn?

As usual I'll have to defer here to the expertise of @cichli, @dpsutton and @bhauman. Probably some session var is getting lost, but I have no idea which one.

PEZ commented

I tried it now. Nashorn works nicely. Maybe there are problems with that as well, but at least not the same problems as I have with Node.

Also, the ”plain” node repl you get from shadow-cljs works swell. Whatever that indicates or does not indicate.