Clojurians
#dirac
<
2017-04-05
>

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

piotr2b10:04:47

Hi :slightly_smiling_face: 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 .
Agent is accepting connections at .
user=> (use 'figwheel-sidecar.repl-api)
user=> (start-figwheel!)
user=> (cljs-repl) ;; trying to get a REPL, got an exception instead because of missing Piggieback
From Emacs I've been trying:
> (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)

piotr2b10:04:35

Thanks for your answer, I gonna read it

darwin10:04:52

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

piotr2b11:04:43

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=> (dirac! :help)
;; You can control Dirac REPL via special `dirac` command:

darwin11:04:49

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

darwin11:04:26

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

piotr2b11:04:31

Thanks anyway for your answers :slightly_smiling_face: I gonna ask #emacs.

darwin11:04:35

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

darwin11:04:56

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

darwin11:04:40

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

piotr2b17:04:25

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?

darwin17:04:53

@piotr2b unexpected-middleware-msg is just a warning

darwin17:04:11

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

darwin17:04:25

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

piotr2b17:04:47

ok, thanks again for your answers :slightly_smiling_face: