nrepl / piggieback

nREPL support for ClojureScript REPLs
480 stars 48 forks source link

Add compatibility with nREPL 0.4 #92

Closed bbatsov closed 6 years ago

bbatsov commented 6 years ago

Now that lein is switching to nREPL 0.4 really soon (https://github.com/technomancy/leiningen/pull/2444 was just merged) it's time to upgrade piggieback and related tools to work with nREPL 0.4 as well.

@bhauman @thheller take a look at the approach I've taken here to retain compatibilities with both nREPL for piggieback. Probably you'll have to do something similar for figwheel and shadow-cljs.

bbatsov commented 6 years ago

I'd also appreciate some help with this strange error:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.RuntimeException: Unable to resolve var: clojure.main/root-cause in this context, compiling:(cider/piggieback.clj:132:17)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:7010)
    at clojure.lang.Compiler.analyze(Compiler.java:6773)

Can't see how this is related to the changes I've made, but I also can't run this locally as I'm on JDK 10. I guess I can just require the clojure.main namespace instead of the way this is currently evaled.

bbatsov commented 6 years ago

An alternative approach would be to try to figure out the nREPL we have to deal with and use require dynamically. Maybe this is going to produce cleaner code. I rarely had to write such type of code, so I'm not sure what's the best approach.

bbatsov commented 6 years ago

With the help of @thheller I figured out the best approach for this. Thanks!