Skip to content

Commit c197cd6

Browse files
committed
Merge pull request #911 from cichli/clojurescript-documentation
[Fix #495] Add some ClojureScript usage documentation.
2 parents f7f953e + eb330d7 commit c197cd6

File tree

1 file changed

+104
-19
lines changed

1 file changed

+104
-19
lines changed

README.md

Lines changed: 104 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,49 @@ CIDER packs plenty of features. Here are some of them (in no particular order):
4444
- [Installation](#installation)
4545
- [Prerequisites](#prerequisites)
4646
- [Installation via package.el](#installation-via-packageel)
47+
- [CIDER nREPL middleware](#cider-nrepl-middleware)
48+
- [Using Leiningen](#using-leiningen)
49+
- [Using embedded nREPL server](#using-embedded-nrepl-server)
4750
- [Configuration](#configuration)
51+
- [Basic configuration](#basic-configuration)
52+
- [Running tests](#running-tests)
53+
- [REPL history](#repl-history)
54+
- [Minibuffer completion](#minibuffer-completion)
55+
- [Auto-completion](#auto-completion)
56+
- [Integration with other modes](#integration-with-other-modes)
4857
- [Basic Usage](#basic-usage)
49-
- [Setting up a Leiningen project (optional)](#setting-up-a-leiningen-project-optional)
50-
- [Launch a nREPL server and client from Emacs](#launch-a-nrepl-server-and-client-from-emacs)
51-
- [Connect to a running nREPL server](#connect-to-a-running-nrepl-server)
52-
- [Using the cider minor mode](#using-the-cider-minor-mode)
53-
- [Pretty printing in the REPL](#pretty-printing-in-the-repl)
54-
- [Limiting printed output in the REPL](#limiting-printed-output-in-the-repl)
58+
- [Setting up a Leiningen project (optional)](#setting-up-a-leiningen-project-optional)
59+
- [Launch a nREPL server and client from Emacs](#launch-a-nrepl-server-and-client-from-emacs)
60+
- [Connect to a running nREPL server](#connect-to-a-running-nrepl-server)
61+
- [Using the cider minor mode](#using-the-cider-minor-mode)
62+
- [Pretty printing in the REPL](#pretty-printing-in-the-repl)
63+
- [Limiting printed output in the REPL](#limiting-printed-output-in-the-repl)
64+
- [ClojureScript usage](#clojurescript-usage)
5565
- [Keyboard shortcuts](#keyboard-shortcuts)
56-
- [cider-mode](#cider-mode)
57-
- [cider-repl-mode](#cider-repl-mode)
58-
- [cider-macroexpansion-mode](#cider-macroexpansion-mode)
59-
- [cider-inspector-mode](#cider-inspector-mode)
60-
- [Managing multiple sessions](#managing-multiple-sessions)
66+
- [cider-mode](#cider-mode)
67+
- [cider-repl-mode](#cider-repl-mode)
68+
- [cider-macroexpansion-mode](#cider-macroexpansion-mode)
69+
- [cider-inspector-mode](#cider-inspector-mode)
70+
- [cider-test-report-mode](#cider-test-report-mode)
71+
- [cider-stacktrace-mode](#cider-stacktrace-mode)
72+
- [Managing multiple sessions](#managing-multiple-sessions)
6173
- [Requirements](#requirements)
6274
- [Caveats](#caveats)
75+
- [ClojureScript limitations](#clojurescript-limitations)
76+
- [Microsoft Windows](#microsoft-windows)
77+
- [powershell.el](#powershell-el)
6378
- [Documentation](#documentation)
6479
- [Changelog](#changelog)
6580
- [Team](#team)
81+
- [Release policy](#release-policy)
82+
- [Logo](#logo)
6683
- [Contributing](#contributing)
84+
- [Discussion](#discussion)
85+
- [Issues](#issues)
86+
- [Patches](#patches)
87+
- [Documentation](#documentation)
88+
- [Donations](#donations)
89+
- [Running the tests in batch mode](#running-the-tests-in-batch-mode)
6790
- [License](#license)
6891

6992
## Installation
@@ -373,7 +396,7 @@ passed or failed:
373396
(setq cider-test-show-report-on-success t)
374397
```
375398

376-
### REPL History
399+
### REPL history
377400

378401
* To make the REPL history wrap around when its end is reached:
379402

@@ -568,6 +591,57 @@ section of your Leiningen project's configuration.
568591
:global-vars {*print-length* 100}
569592
```
570593

594+
### ClojureScript usage
595+
596+
ClojureScript support relies on the
597+
[piggieback](https://github.com/cemerick/piggieback) nREPL middleware being
598+
present in your REPL session. This is supported by (and is the recommended
599+
method for using) both the [Austin](https://github.com/cemerick/austin) and
600+
[Weasel](https://github.com/tomjakubowski/weasel) ClojureScript REPLs.
601+
602+
* Example usage of a non-browser connected Austin REPL (requires
603+
e.g. `[com.cemerick/austin "0.1.5"]` in your project's `:plugins`):
604+
605+
- At the Clojure REPL:
606+
607+
```clojure
608+
(cemerick.piggieback/cljs-repl
609+
:repl-env (cemerick.austin/exec-env))
610+
```
611+
612+
* Example usage of browser-connected Weasel REPL (requires e.g. `[weasel "0.4.2"]` in your project's
613+
`:dependencies`):
614+
615+
- At the Clojure REPL:
616+
617+
```clojure
618+
(require 'weasel.repl.websocket)
619+
(cemerick.piggieback/cljs-repl
620+
:repl-env (weasel.repl.websocket/repl-env :ip "0.0.0.0"
621+
:port 9001))
622+
```
623+
624+
- and in your ClojureScript:
625+
626+
```clojure
627+
(ns my.cljs.core
628+
(:require [weasel.repl :as ws-repl]))
629+
630+
(ws-repl/connect "ws://localhost:9001")
631+
```
632+
633+
The [clojure-quick-repls](https://github.com/symfrog/clojure-quick-repls)
634+
library provides helper functions to automate REPL creation for both Clojure and
635+
Clojurescript, and will also automatically route requests to the correct REPL
636+
according to the file extension of the current buffer (note that CIDER does not
637+
provide the latter functionality out-of-the-box).
638+
639+
Provided that a Piggieback-enabled ClojureScript environment is active in your
640+
REPL session, code loading and evaluation will work seamlessly regardless of the
641+
presence of the `cider-nrepl` middleware. If the middleware is present then most
642+
other features of CIDER will also be enabled (including code completion,
643+
documentation lookup, the namespace browser, and macroexpansion).
644+
571645
## Keyboard shortcuts
572646

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

756830
## Caveats
757831

758-
### Completion
832+
### ClojureScript limitations
833+
834+
Currently, the following features are not supported for ClojureScript
835+
development:
836+
837+
* Grimoire lookup
838+
* The inspector
839+
* Reloading
840+
* Running tests
841+
* Tracing
842+
843+
There is currently no support for both Clojure and ClojureScript evaluation in
844+
the same nREPL session. If Piggieback is active, code evaluation and all
845+
features will assume ClojureScript.
759846

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.
847+
The aforementioned
848+
[clojure-quick-repls](https://github.com/symfrog/clojure-quick-repls) aids this
849+
situation by routing requests to the correct REPL according to the file
850+
extension of the current buffer.
766851

767852
### Microsoft Windows
768853

0 commit comments

Comments
 (0)