@@ -79,13 +79,22 @@ helpful for identifying each host.
79
79
80
80
## ClojureScript usage
81
81
82
- ClojureScript support relies on the [ piggieback] [ ] nREPL middleware being
83
- present in your REPL session.
82
+ CIDER works with ClojureScript, but you should keep in mind that not all
83
+ the functionality available with Clojure exists for ClojureScript (at least
84
+ not yet). To give you a concrete example - things like running tests and
85
+ the debugger are currently Clojure-only features.
84
86
85
- Add the following dependencies to your project (` project.clj ` in
86
- Leiningen based project or ` build.boot ` in Boot project):
87
+ ClojureScript support relies on the [ piggieback] [ ] nREPL middleware
88
+ being present in your REPL session. There's one exception to this,
89
+ though - [ shadow-cljs] [ ] . It has its own nREPL middleware and doesn't rely
90
+ on piggieback at all.
91
+
92
+ To setup piggieback add the following dependencies to your project
93
+ (` project.clj ` in Leiningen based project or ` build.boot ` in Boot
94
+ project):
87
95
88
96
``` clojure
97
+ ; ; use whatever are the most recent versions here
89
98
[cider/piggieback " 0.3.1" ]
90
99
[org.clojure/clojure " 1.7.0" ]
91
100
```
@@ -117,6 +126,33 @@ ClojureScript. All usual CIDER commands will be automatically directed to the
117
126
appropriate REPL, depending on whether you're visiting a ` .clj ` or a ` .cljs `
118
127
file.
119
128
129
+ ` cider-jack-in-clojurescript ` will prompt you about the type of
130
+ ClojureScript to start. Keep in mind that some of the REPLs will
131
+ require some additional setup, before you can make use of them (e.g. you'll
132
+ need to have Node.js installed to be able to start a node REPL).
133
+
134
+ You can suppress the prompt the REPL to use by setting ` cider-default-cljs-repl ` .
135
+ Here's an example that will make Nashorn the default:
136
+
137
+ ``` el
138
+ (setq cider-default-cljs-repl "Nashorn")
139
+ ```
140
+
141
+ All supported ClojureScript REPLs are stored in
142
+ ` cider-cljs-repl-types ` . If you need to extend it, you should use
143
+ ` cider-register-cljs-repl-type ` in your Emacs configuration.
144
+
145
+ ``` el
146
+ (cider-register-cljs-repl-type "super-cljs" "(do (...))" optional-requirements-function)
147
+ ```
148
+
149
+ You can also create a ClojureScript REPL with the command
150
+ ` cider-create-sibling-cljs-repl ` in cases where you already have a
151
+ Clojure REPL running.
152
+
153
+ Continue reading for the additional setup needed for the various ClojureScript
154
+ REPLs out there.
155
+
120
156
### Browser-connected ClojureScript REPL
121
157
122
158
Using Weasel, you can also have a browser-connected REPL.
@@ -213,9 +249,26 @@ CIDER will determine which to use based on the type of file you're editing.
213
249
You should also check out
214
250
[ Figwheel's wiki] ( https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl ) .
215
251
252
+ ### Using shadow-cljs
253
+
254
+ Provided you've configured your project correctly you can simply use
255
+ ` cider-jack-in-clojurescript ` to use ` shadow-cljs ` .
256
+
257
+ This will automatically start the shadow-cljs server and connect to it. You'll also
258
+ be prompted for the build to use.
259
+
260
+ Alternatively you can start the server manually with something like:
261
+
262
+ ```
263
+ npx shadow-cljs server
264
+ ```
265
+
266
+ And connect to it with ` cider-connect ` .
267
+
216
268
[ leiningen ] : http://leiningen.org/
217
269
[ boot ] : http://boot-clj.com/
218
270
[ piggieback ] : https://github.com/clojure-emacs/piggieback
271
+ [ shadow-cljs ] : https://github.com/thheller/shadow-cljs
219
272
220
273
## Working with ` .cljc ` files
221
274
0 commit comments