This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-22
Channels
- # 100-days-of-code (1)
- # adventofcode (21)
- # announcements (2)
- # beginners (44)
- # calva (1)
- # cider (2)
- # cljdoc (16)
- # cljs-dev (70)
- # cljsrn (29)
- # clojure (66)
- # clojure-austria (1)
- # clojure-europe (4)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-uk (127)
- # clojurescript (30)
- # core-typed (3)
- # cursive (34)
- # data-science (2)
- # datomic (16)
- # duct (17)
- # editors (1)
- # emacs (4)
- # figwheel-main (4)
- # fulcro (40)
- # hoplon (2)
- # instaparse (5)
- # kaocha (4)
- # leiningen (1)
- # luminus (4)
- # nrepl (46)
- # off-topic (5)
- # onyx (2)
- # other-languages (55)
- # parinfer (3)
- # protorepl (4)
- # re-frame (33)
- # reagent (6)
- # reitit (13)
- # ring-swagger (5)
- # shadow-cljs (26)
- # spacemacs (4)
- # sql (8)
- # testing (27)
- # tools-deps (21)
- # yada (1)
@bozhidar, OK. So now I got the time to try this again. If I remove the dependency on sidecar all together, things that used to work, still work (in Calva). Except anything ClojureScript, of course. Is Cider working with ClojureScript using the new nrepl?
The problem is not nREPL - the problem is the dependency loading got messed up in your case and you’re running one version of the server and middleware that expects the other one.
I hope that this makes sense. With user.clj
your altering the expected load order of the libraries, so and in your case it seems to me that sidecar loads the legacy tools.nrepl at some point even though you’re actually trying to connect to the new one.
That’s going to be fixed for good when I completely kill the support for tools.nrepl in a release or two. But for now without a lein release in a long time it was necessary.
I think I have understood that the problem is not nREPL. 😄 But even without user.clj
I get that trace as long as I have a dependency on sidecar
. And without sidecar I don’t know how to start the cljs repl (for Figwheel projects).
@dominicm Yeah, but this can only happen if some dep explicitly requires tools.nrepl
in the mean time, which should not happen most of the time.
Because I assume that most libraries will follow the same pattern as us - have a hard dep on nrepl and dynamically select tools.nrepl if it happens to be present. At least that’s what all the libs I’m involved with do.
@pez It’s all about the load order - if you load all middleware first this is going to work just fine.
As you can see sidecar has support for the new nREPL https://github.com/bhauman/lein-figwheel/blob/dfd010d372280746f64397328fb9a402d448276d/sidecar/src/figwheel_sidecar/components/nrepl_server.clj#L6
Probably just changing the dependency that sidecar has is going to fix this, but I don’t have time to look into this. You can update project.clj, build it locally and try.
If no other lib you use has a dep on tools.nrepl then this must the root cause of the problem.
But it still seems strange that I need a patched sidecar, when you don’t. There is something important I am not getting here.
But I also have no other deps. I always do just very basic cljs tests as I don’t do cljs myself.
OK. So I should look at what cider-jack-in does. It was a while since I did that. Calva needs something similar. Badly.
I assume it’s going to be pretty easy for you to just carbon-copy CIDER’s approach, as there’s nothing specific about it.
We just build a command string that will start nREPL + the necessary middleware, run it and parse its output to check when the server has started.
OK. So if I remove that dependency from sidecar
’s projectclj
and move piggieback
up before nrepl
in :dependencies
, then it works. I can even have my user.clj
and use that for starting the cljs repl.
For some misconfigurations, sidecar (I think) gives some hints about piggieback and adds:
Note: Cider will inject this config into your project.clj.
This can cause confusion when your are not using Cider.
You could say that again. 😄I am trying to cling on to this new knowledge. As well as act on the, not so subtle, hints the process has given me about the need for calva-jack-in.
Also questioning my decision to start with tooling for a language that was so new to me, in all ways possible. But I’ll compensate with a blood, sweat, tears and a happy mood…
Well, the process was relatively similar for me as well. I started CIDER with relatively little experience with Clojure, but it somehow worked out (more or less) well.