dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
piotr-yuxuan 2017-04-05T10:22:47.376958Z

Hi 🙂 How could I connect to cljs REPL when using Dirac? Figwheel standard way (https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl) doesn't work because Dirac is a Piggieback middleware fork, so we cannot run both of them.

$ lein repl
user=> (require 'dirac.agent)
user=> (dirac.agent/boot!)
Dirac Agent v1.2.3
Connected to nREPL server at <nrepl://localhost:8230>.
Agent is accepting connections at <ws://localhost:8231>.
user=&gt; (use 'figwheel-sidecar.repl-api)
user=&gt; (start-figwheel!)
user=&gt; (cljs-repl) ;; trying to get a REPL, got an exception instead because of missing Piggieback
From Emacs I've been trying:
&gt; (cider-connect)
; Host: localhost
; Port 8231
;; [nREPL] Establishing direct connection to localhost:8231 ...
;; [nREPL] Direct connection established
;; progn: Sync nREPL request timed out (op clone id 1)

2017-04-05T10:32:12.518548Z

hm, have you tried to look here? https://github.com/binaryage/dirac/blob/master/docs/integration.md

piotr-yuxuan 2017-04-05T10:33:35.538798Z

Thanks for your answer, I gonna read it

2017-04-05T10:33:52.542743Z

you can connect to an existing clojure nREPL server with dirac support loaded - then (dirac! :join) to join an existing dirac cljs REPL session

piotr-yuxuan 2017-04-05T11:03:43.974408Z

Cool! In Emacs I do (cider-jack-in) to launch a REPL then I enter (dirac! :version) but I got these error messages:

error in process filter: if: [nREPL] No response handler with id nil found
error in process filter: [nREPL] No response handler with id nil found
When I launch a REPL from the terminal it works like a charm:
$lein repl
user=&gt; (dirac! :help)
;; You can control Dirac REPL via special `dirac` command:

2017-04-05T11:14:49.128945Z

@piotr2b I don’t use Emacs and I’m not familiar with CIDER, I’m sorry

2017-04-05T11:15:26.137692Z

AFAIK CIDER expects a bunch of its own middleware loaded in the nREPL server

piotr-yuxuan 2017-04-05T11:26:31.288695Z

Thanks anyway for your answers 🙂 I gonna ask #emacs.

2017-04-05T11:27:35.303039Z

depends what is your goal here, if you want to use CIDER for code completions, you should be able to setup a separate nREPL server with CIDER middleware and talk to it instead of the dirac-enabled-nREPL-server

2017-04-05T11:27:56.307814Z

for cljs code evaluations, you should talk to the dirac-enabled-nREPL-server via a joined session

2017-04-05T11:29:40.331237Z

Dirac middleware and CIDER cannot live together in one nREPL server, AFAIK

2017-04-05T11:30:06.337430Z

here is a schema how dirac works internally: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md#dirac

piotr-yuxuan 2017-04-05T17:05:25.771070Z

I found this line: https://github.com/binaryage/dirac/blob/90ddd0f0c47a8d952be902d891e80d81e2cd4556/src/lib/dirac/lib/nrepl_tunnel.clj#L78 Indeed I tried to do something like

:nrepl-middleware [dirac.nrepl/middleware
                   cider.nrepl.middleware.apropos/wrap-apropos
                   …]
I know (thanks to the doc) that Piggieback mustn’t be use in conjunction will Dirac, but does this line suggest no other middlewares are tolerated by Dirac?

2017-04-05T17:07:53.834790Z

@piotr2b unexpected-middleware-msg is just a warning

2017-04-05T17:08:11.842275Z

some people mixed dirac middleware with other middleware and that caused unexpected errors

2017-04-05T17:08:25.848621Z

this is a way how to warn people that they might run into troubles

piotr-yuxuan 2017-04-05T17:09:47.884046Z

ok, thanks again for your answers 🙂