Awesome! Thanks.
Works beautifully.
There is one thing I was wondering about. Everything is working fine in the Chrome Devtools, but am I also supposed to be able to reuse my Cider REPL to interact with the browser?
I have never tried it myself, I'
I’m a cursive user
if you are dependent on piggieback middleware it might not work, because dirac middleware replaces it
I only briefly tested that it does not conflict with cider middleware: https://github.com/binaryage/dirac-sample/blob/master/project.clj#L92
Do you connect to the browser via your Cursive REPL or via Chrome Devtools?
I use chrome devtools most of the time, but you could try something like this with Emacs: https://github.com/binaryage/dirac/blob/master/docs/integration.md
it should work in theory, I’m just not sure if you could get some more advanced things out of it, I’m assuming cider uses piggieback to eval stuff in cljs
I remember that. It used to work. Not anymore.
When I type the dirac! command it produces error in process filter: nrepl--dispatch-response: [nREPL] No response handler with id nil found
hmm
I have this: (swap! boot.repl/*default-middleware* conj 'dirac.nrepl/middleware)
in my build.boot
`
And I'm using the latest boot-cljs-devtools
well, try to print boot.repl/*default-middleware*
, so we can see what is in there
Yes, it's there.
I think it is a conflict with some other middleware, so I want to see the full list
But I need to connect to port 8230 directly, or does the middleware reroute the commands?
I’m not using boot personally so I’m just guessing
you should connect normal nREPL client to 8230, you get normal Clojure REPL session, if dirac middleware is present and working, it should recognise the dirac!
command
Ah, a normal nrepl client, not the cider nrepl client?
I don’t know what cider does
I assume it is just an nREPL client and bunch of cooperating middleware
I don’t know what it expects when connected to nREPL server
could you first try to connect plain nREPL client to your nREPL server?
for example via lein repl ...
Right. I don't know much of the internals neither. Yes, I'll try that.
let me look for the exact command
lein repl :connect 8230
see lein help repl
for more details
then you should be able to (dirac! :status)
for example
I actually am looking at the boot equivalents.
I connected with the boot nrepl client. That works perfectly.
It joined the dirac session and everything works as expected.
But I won't use this as the Chrome Devtools gives us a superior experience.
I remember that I managed to do the same from the cider REPL client. But it doesn't seem to work anymore.
Not a big deal.
Chrome DevTools will do.
my theory with your cider setup: some cider middleware gets to process nREPL messages before dirac middleware, that means it eats (dirac! …)
messages, and fails on them for whatever reason
easy solution would be to make sure that your middleware list includes dirac first and then all cider stuff, if possible
also dirac middleware relies on standard session
and ieval
middlewares, which are included by default, if cider tries to change this, it could confuse dirac
but the error message is definitely not produced by dirac middleware
It seems that these are the loaded middleware: cider.nrepl/cider-middleware, refactor-nrepl.middleware/wrap-refactor and dirac.nrepl/middleware
can you change the order?
I can try.
OK, this is the order now: dirac.nrepl/middleware, cider.nrepl/cider-middleware and refactor-nrepl.middleware/wrap-refactor
and?
Still erroring out.
I notice that the REPL prompt changes to cljs.user
aha
type :cljs/quit
it returns the symbol.
Doesn't seem to be doing much.
hmm
so it is not piggieback, piggieback would quit cljs REPL and exit into “shell” clojure REPL
you should somehow tell cider to connect to standard clojure nREPL session and don’t do anything more
Right. This is a bit of yak shaving. I better move on. I won't sweat it because the Chrome DevTools with Dirac is superb as it is. Thanks a lot for the help. And thanks especially for Dirac and the effort you put in it. Happy New Year!
thanks, best wishes to you as well 🙂