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=> (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)
hm, have you tried to look here? https://github.com/binaryage/dirac/blob/master/docs/integration.md
Thanks for your answer, I gonna read it
you can connect to an existing clojure nREPL server with dirac support loaded - then (dirac! :join)
to join an existing dirac cljs REPL session
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:
@piotr2b I don’t use Emacs and I’m not familiar with CIDER, I’m sorry
AFAIK CIDER expects a bunch of its own middleware loaded in the nREPL server
Thanks anyway for your answers 🙂 I gonna ask #emacs.
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
for cljs code evaluations, you should talk to the dirac-enabled-nREPL-server via a joined session
Dirac middleware and CIDER cannot live together in one nREPL server, AFAIK
here is a schema how dirac works internally: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md#dirac
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?@piotr2b unexpected-middleware-msg is just a warning
some people mixed dirac middleware with other middleware and that caused unexpected errors
this is a way how to warn people that they might run into troubles
ok, thanks again for your answers 🙂