Skip to content

Commit 0a63bfd

Browse files
committed
[Fix #495] Add some ClojureScript usage documentation.
1 parent f7f953e commit 0a63bfd

File tree

1 file changed

+71
-7
lines changed

1 file changed

+71
-7
lines changed

README.md

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ CIDER packs plenty of features. Here are some of them (in no particular order):
5252
- [Using the cider minor mode](#using-the-cider-minor-mode)
5353
- [Pretty printing in the REPL](#pretty-printing-in-the-repl)
5454
- [Limiting printed output in the REPL](#limiting-printed-output-in-the-repl)
55+
- [ClojureScript usage](#clojurescript-usage)
56+
- [ClojureScript usage](#clojurescript-usage)
5557
- [Keyboard shortcuts](#keyboard-shortcuts)
5658
- [cider-mode](#cider-mode)
5759
- [cider-repl-mode](#cider-repl-mode)
@@ -568,6 +570,57 @@ section of your Leiningen project's configuration.
568570
:global-vars {*print-length* 100}
569571
```
570572

573+
### ClojureScript usage
574+
575+
ClojureScript support relies on the
576+
[piggieback](https://github.com/cemerick/piggieback) nREPL middleware being
577+
present in your REPL session. This is supported by (and is the recommended
578+
method for using) both the [Austin](https://github.com/cemerick/austin) and
579+
[Weasel](https://github.com/tomjakubowski/weasel) ClojureScript REPLs.
580+
581+
* Example usage of a non-browser connected Austin REPL (requires
582+
e.g. `[com.cemerick/austin "0.1.5"]` in your project's `:plugins`):
583+
584+
- At the Clojure REPL:
585+
586+
```clojure
587+
(cemerick.piggieback/cljs-repl
588+
:repl-env (cemerick.austin/exec-env))
589+
```
590+
591+
* Example usage of browser-connected Weasel REPL (requires e.g. `[weasel "0.4.2"]` in your project's
592+
`:dependencies`):
593+
594+
- At the Clojure REPL:
595+
596+
```clojure
597+
(require 'weasel.repl.websocket)
598+
(cemerick.piggieback/cljs-repl
599+
:repl-env (weasel.repl.websocket/repl-env :ip "0.0.0.0"
600+
:port 9001))
601+
```
602+
603+
- and in your ClojureScript:
604+
605+
```clojure
606+
(ns my.cljs.core
607+
(:require [weasel.repl :as ws-repl]))
608+
609+
(ws-repl/connect "ws://localhost:9001")
610+
```
611+
612+
The [clojure-quick-repls](https://github.com/symfrog/clojure-quick-repls)
613+
library provides helper functions to automate REPL creation for both Clojure and
614+
Clojurescript, and will also automatically route requests to the correct REPL
615+
according to the file extension of the current buffer (note that CIDER does not
616+
provide the latter functionality out-of-the-box).
617+
618+
Provided that a Piggieback-enabled ClojureScript environment is active in your
619+
REPL session, code loading and evaluation will work seamlessly regardless of the
620+
presence of the `cider-nrepl` middleware. If the middleware is present then most
621+
other features of CIDER will also be enabled (including code completion,
622+
documentation lookup, the namespace browser, and macroexpansion).
623+
571624
## Keyboard shortcuts
572625

573626
* <kbd>M-x cider-jack-in</kbd>: Launch an nREPL server and a REPL client.
@@ -755,14 +808,25 @@ change `*cider-repl localhost*` to `*cider-repl foo*`.
755808

756809
## Caveats
757810

758-
### Completion
811+
### ClojureScript
812+
813+
Currently, the following features are not supported for ClojureScript
814+
development:
815+
816+
* Grimoire lookup
817+
* The inspector
818+
* Reloading
819+
* Running tests
820+
* Tracing
821+
822+
There is currently no support for both Clojure and ClojureScript evaluation in
823+
the same nREPL session. If Piggieback is active, code evaluation and all
824+
features will assume ClojureScript.
759825

760-
ClojureScript completion is provided by the
761-
[cider-nrepl](https://github.com/clojure-emacs/cider-nrepl) 'complete'
762-
implementation middleware which relies on
763-
[piggieback](https://github.com/cemerick/piggieback). Include it in
764-
your project middlewares and call `(cemerick.piggieback/cljs-repl)` or
765-
another method to start up the ClojureScript REPL.
826+
The aforementioned
827+
[clojure-quick-repls](https://github.com/symfrog/clojure-quick-repls) aids this
828+
situation by routing requests to the correct REPL according to the file
829+
extension of the current buffer.
766830

767831
### Microsoft Windows
768832

0 commit comments

Comments
 (0)