Skip to content

Commit 784e8fd

Browse files
arichiardivemv
andauthored
Add Embedded nREPL section to the README (#341)
* Add Embedded REPL section to the README * Expand on Embedded nREPL in README Co-authored-by: vemv <vemv@users.noreply.github.com>
1 parent 0306180 commit 784e8fd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ Add the following in `~/.boot/profile.boot`:
4444
'refactor-nrepl.middleware/wrap-refactor)
4545
```
4646

47+
### Embedded nREPL
48+
49+
You may want launch your own nREPL server with CIDER and refactor-nrepl in it. You'll be able to [`cider-connect`](https://github.com/clojure-emacs/cider/blob/6a17686799b7ef97bc15fa041016421e5c875bfb/cider.el#L1150) to said server.
50+
51+
For that, you can use the following (more info can be found in the [nREPL Server docs](https://nrepl.org/nrepl/usage/server.html#embedding-nrepl) and [CIDER docs](https://docs.cider.mx/cider/basics/middleware_setup.html#using-embedded-nrepl-server)):
52+
53+
```clojure
54+
(def custom-nrepl-handler
55+
"We build our own custom nrepl handler, mimicking CIDER's."
56+
(apply nrepl-server/default-handler
57+
(conj cider.nrepl.middleware/cider-middleware 'refactor-nrepl.middleware/wrap-refactor)))
58+
59+
(nrepl-server/start-server :port port :address bind-address :handler custom-nrepl-handler)
60+
```
61+
62+
The `cider-middleware` is technically optional but highly recommended.
63+
4764
### Passing messages to and from refactor-nrepl
4865

4966
We've already called this a middleware, but we haven't really talked

0 commit comments

Comments
 (0)