-
Notifications
You must be signed in to change notification settings - Fork 21
REPL in Cursive
Mike Fikes edited this page Jun 18, 2015
·
21 revisions
Normally, Cursive makes use of nREPL, but doesn't support nREPL's {:status :need-input}
. (See cursiveclojure/cursive#358.)
Thus, if you start Ambly using
(repl/repl (ambly/repl-env))
you will see
Choice: DEBUG: unknown status need-input
.
There are two ways to avoid this:
With Cursive 0.1.51 or later you can choose "Use clojure.main in normal JVM process" when configuring the Cursive REPL. Then, you can start Ambly using
(require
'[cljs.repl :as repl]
'[ambly.core :as ambly])
(repl/repl (ambly/repl-env))
With Piggieback, you can use nREPL (but you will not be able to control which device Ambly connects to):
- Add
[com.cemerick/piggieback "0.2.0"]
to your project dependencies. - Ensure you explicitly pin a later nREPL implementation by including the following in your
project.cl
(workaround for a Leiningen issue)::profiles {:dev {:dependencies [[org.clojure/tools.nrepl "0.2.10"]]}}
- Mix in the Piggyback middleware by adding
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
to yourproject.clj
. - Issue the following two forms in the Cursive REPL
(require
'[cljs.repl :as repl]
'[cemerick.piggieback]
'[ambly.core :as ambly])
(cemerick.piggieback/cljs-repl
(ambly/repl-env :choose-first-discovered true))
The above will cause Ambly to connect to the first discovered device. (The menu that allows you to choose a device relies on the ability to call read-line
, which isn't supported owing to the current lack of support for nREPL {:status :need-input}
.)