Clojurians
#dirac
<
2016-12-31
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

danielsz19:12:37

Awesome! Thanks.

danielsz19:12:09

Works beautifully.

danielsz19:12:08

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?

darwin19:12:42

I have never tried it myself, I'

darwin19:12:48

I’m a cursive user

darwin19:12:23

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

darwin19:12:11

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

danielsz19:12:16

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

darwin19:12:56

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

darwin19:12:52

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

danielsz19:12:45

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

danielsz19:12:12

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

danielsz19:12:46

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

danielsz19:12:29

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

darwin19:12:31

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

danielsz19:12:41

Yes, it's there.

darwin19:12:11

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

danielsz19:12:21

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

darwin19:12:23

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

darwin19:12:46

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

danielsz19:12:30

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

darwin19:12:56

I don’t know what cider does

darwin19:12:16

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

darwin19:12:36

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

darwin19:12:52

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

darwin19:12:08

for example via lein repl ...

danielsz19:12:11

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

darwin19:12:16

let me look for the exact command

darwin19:12:59

lein repl :connect 8230

darwin19:12:11

see lein help repl for more details

darwin19:12:30

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

danielsz19:12:31

I actually am looking at the boot equivalents.

danielsz19:12:47

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

danielsz19:12:05

It joined the dirac session and everything works as expected.

danielsz19:12:55

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

danielsz19:12:36

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

danielsz19:12:47

Not a big deal.

danielsz19:12:06

Chrome DevTools will do.

darwin19:12:37

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

darwin20:12:04

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

darwin20:12:48

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

darwin20:12:03

but the error message is definitely not produced by dirac middleware

danielsz20:12:38

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

darwin20:12:39

can you change the order?

danielsz20:12:17

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

danielsz20:12:14

Still erroring out.

danielsz20:12:29

I notice that the REPL prompt changes to cljs.user

darwin20:12:44

type :cljs/quit

danielsz20:12:18

it returns the symbol.

danielsz20:12:33

Doesn't seem to be doing much.

darwin20:12:58

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

darwin20:12:20

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

danielsz20:12:24

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!

darwin20:12:53

thanks, best wishes to you as well :slightly_smiling_face: