Fork me on GitHub

What is the minimal setup to get a clojurescript REPL working with Cursive? I’ve tried the following: - Minimal deps: {:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}}} - Start a standard nREPL through the launch configuration. - Run the following:

(require '[cljs.repl.browser :as b]
         '[cljs.repl :as r])
(r/repl (b/repl-env))
This will work, except that the REPL keeps prompting me for standard input with a modal…


As you know, Cursive works via NRepl really well.


This is because the IDE can basically talk RPC over a socket.


With the built-in REPL prompt, the host process is always begging for user input.


When you fire up a raw cljs repl, that’s exactly what you’re doing: Starting a process that continually prompts for user input.


I think Colin has been working on a better cljs repl for some time.


But the fix right now is to use a piggieback repl:


This creates a faux nrepl that you can talk over.


the invocation is basically the same:

(pb/cljs-repl (b/repl-env))


here is a full example which you can just copy-paste as is. in 1 shell run a clojure socket repl which will be handled by a clojurescript repl server:

clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.1"} org.clojure/clojurescript {:mvn/version "1.10.520"}}}' -J-Dclojure.server.repl="{:port 5555 :accept cljs.server.browser/repl}"
this also drops you into a regular clojure repl which is connected to your terminal's standard i/o. from an other shell, run a tubular socket repl client like this:
clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.1"} tubular {:mvn/version "1.3.0"}}}' -m tubular.core -p 5555
this will try to connect to the socket repl server. that incoming connection to the 1st process will trigger it start a new cljs repl environment by opening a browser tab, which tab then connects back to that 1st process websockets. that 1st process then forwards the repl chatter back and forth to the tubular socket repl client in the 2nd process, which displays in on the 2nd terminal's standard i/o


if you start the tubular client with cursive as a clojure.main repl, then the repl discourse will be handled by the cursive repl tool window, instead of a terminal's stdio