dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
danielsz 2016-12-31T19:13:37.001078Z

Awesome! Thanks.

danielsz 2016-12-31T19:37:09.001079Z

Works beautifully.

1
danielsz 2016-12-31T19:39:08.001080Z

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?

2016-12-31T19:39:42.001081Z

I have never tried it myself, I'

2016-12-31T19:39:48.001082Z

I’m a cursive user

2016-12-31T19:40:23.001083Z

if you are dependent on piggieback middleware it might not work, because dirac middleware replaces it

2016-12-31T19:41:11.001084Z

I only briefly tested that it does not conflict with cider middleware: https://github.com/binaryage/dirac-sample/blob/master/project.clj#L92

danielsz 2016-12-31T19:42:16.001086Z

Do you connect to the browser via your Cursive REPL or via Chrome Devtools?

2016-12-31T19:42:56.001087Z

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

2016-12-31T19:43:52.001089Z

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

danielsz 2016-12-31T19:44:45.001090Z

I remember that. It used to work. Not anymore.

danielsz 2016-12-31T19:46:12.001091Z

When I type the dirac! command it produces error in process filter: nrepl--dispatch-response: [nREPL] No response handler with id nil found

2016-12-31T19:46:43.001092Z

hmm

danielsz 2016-12-31T19:46:46.001093Z

I have this: (swap! boot.repl/*default-middleware* conj 'dirac.nrepl/middleware) in my build.boot `

danielsz 2016-12-31T19:47:29.001095Z

And I'm using the latest boot-cljs-devtools

2016-12-31T19:47:31.001096Z

well, try to print boot.repl/*default-middleware*, so we can see what is in there

danielsz 2016-12-31T19:47:41.001097Z

Yes, it's there.

2016-12-31T19:48:11.001098Z

I think it is a conflict with some other middleware, so I want to see the full list

danielsz 2016-12-31T19:48:21.001099Z

But I need to connect to port 8230 directly, or does the middleware reroute the commands?

2016-12-31T19:48:23.001100Z

I’m not using boot personally so I’m just guessing

2016-12-31T19:49:46.001101Z

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

danielsz 2016-12-31T19:50:30.001102Z

Ah, a normal nrepl client, not the cider nrepl client?

2016-12-31T19:50:56.001104Z

I don’t know what cider does

2016-12-31T19:51:16.001105Z

I assume it is just an nREPL client and bunch of cooperating middleware

2016-12-31T19:51:36.001106Z

I don’t know what it expects when connected to nREPL server

2016-12-31T19:51:52.001107Z

could you first try to connect plain nREPL client to your nREPL server?

2016-12-31T19:52:08.001108Z

for example via lein repl ...

danielsz 2016-12-31T19:52:11.001109Z

Right. I don't know much of the internals neither. Yes, I'll try that.

2016-12-31T19:52:16.001110Z

let me look for the exact command

2016-12-31T19:52:59.001111Z

lein repl :connect 8230

2016-12-31T19:53:11.001112Z

see lein help repl for more details

2016-12-31T19:53:30.001113Z

then you should be able to (dirac! :status) for example

danielsz 2016-12-31T19:53:31.001114Z

I actually am looking at the boot equivalents.

danielsz 2016-12-31T19:56:47.001115Z

I connected with the boot nrepl client. That works perfectly.

danielsz 2016-12-31T19:57:05.001116Z

It joined the dirac session and everything works as expected.

danielsz 2016-12-31T19:57:55.001117Z

But I won't use this as the Chrome Devtools gives us a superior experience.

danielsz 2016-12-31T19:58:36.001118Z

I remember that I managed to do the same from the cider REPL client. But it doesn't seem to work anymore.

danielsz 2016-12-31T19:58:47.001119Z

Not a big deal.

danielsz 2016-12-31T19:59:06.001120Z

Chrome DevTools will do.

2016-12-31T19:59:37.001121Z

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

2016-12-31T20:00:04.001122Z

easy solution would be to make sure that your middleware list includes dirac first and then all cider stuff, if possible

2016-12-31T20:01:48.001123Z

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

2016-12-31T20:02:03.001124Z

but the error message is definitely not produced by dirac middleware

danielsz 2016-12-31T20:03:38.001125Z

It seems that these are the loaded middleware: cider.nrepl/cider-middleware, refactor-nrepl.middleware/wrap-refactor and dirac.nrepl/middleware

2016-12-31T20:04:39.001126Z

can you change the order?

danielsz 2016-12-31T20:05:20.001127Z

I can try.

danielsz 2016-12-31T20:12:17.001128Z

OK, this is the order now: dirac.nrepl/middleware, cider.nrepl/cider-middleware and refactor-nrepl.middleware/wrap-refactor

2016-12-31T20:13:03.001129Z

and?

danielsz 2016-12-31T20:13:14.001130Z

Still erroring out.

danielsz 2016-12-31T20:13:29.001131Z

I notice that the REPL prompt changes to cljs.user

2016-12-31T20:13:37.001132Z

aha

2016-12-31T20:13:44.001133Z

type :cljs/quit

danielsz 2016-12-31T20:14:18.001134Z

it returns the symbol.

danielsz 2016-12-31T20:14:33.001135Z

Doesn't seem to be doing much.

2016-12-31T20:14:38.001136Z

hmm

2016-12-31T20:14:58.001137Z

so it is not piggieback, piggieback would quit cljs REPL and exit into “shell” clojure REPL

2016-12-31T20:16:20.001138Z

you should somehow tell cider to connect to standard clojure nREPL session and don’t do anything more

danielsz 2016-12-31T20:28:24.001139Z

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!

2016-12-31T20:28:53.001140Z

thanks, best wishes to you as well 🙂