Skip to content

Commit 238baef

Browse files
committed
[Docs] Improve the session management docs
1 parent 050bf63 commit 238baef

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

doc/modules/ROOT/pages/usage/managing_connections.adoc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ you're using the right connection. This problem was further compounded by the cr
2626
* Eventually we introduced the concept of dynamic dispatch, where we'd use a combination of the filename extension and the project directory to figure out where to send operations. This approach worked reasonably well, but was problematic when you had multiple connections of the same type for the same project. There was also no logical grouping of related connections.
2727
* This brings us to the present - today's approach to managing multiple connections is an evolution of the dynamic dispatch.
2828
Related connections are grouped together in sessions, which are tied to some context (typically a project directory). If some
29-
operation dispatch is ambiguous it will fail with an error message. You can manually link buffers, files and directories
29+
operation dispatch is ambiguous it will fail with an error message. You can manually link (attach) buffers, files and directories
3030
to sessions in such situations.
3131
3232
In the following sections we'll go over the basic terminology with respect to connection management, and we'll cover
@@ -43,7 +43,9 @@ sessions. Each session is a collection of connections which share the same nREPL
4343
server. You can, however, have multiple sessions sharing the same nREPL server (although you're unlikely to
4444
ever need this).
4545

46-
Start new sessions with
46+
=== Starting New Sessions
47+
48+
You can start new sessions with the following commands:
4749

4850
* kbd:[C-c C-x j j] (`cider-jack-in-clj`)
4951
* kbd:[C-c C-x j s] (`cider-jack-in-cljs`)
@@ -52,11 +54,30 @@ Start new sessions with
5254
* kbd:[C-c C-x c s] (`cider-connect-cljs`)
5355
* kbd:[C-c C-x c m] (`cider-connect-clj&cljs`)
5456

55-
Add new REPLs to the current session with
57+
If a command creates multiple REPLs (e.g. `cider-jack-in-clj&cljs`) they are going to be added to the same session.
58+
59+
You'll normally get a warning if you try to create a new session for
60+
some project if there's already an existing session for it (e.g. after
61+
running `cider-jack-in-cljs` after `cider-jack-in-clj` for the same
62+
project). Generally in such cases it's preferred to use commands that
63+
can add more REPLs to the existing session. We'll cover those in the next section.
64+
65+
=== Adding REPLs to a Session
66+
67+
You can add new REPLs to the current session with:
5668

5769
* kbd:[C-c C-x s j] (`cider-connect-sibling-clj`)
5870
* kbd:[C-c C-x s s] (`cider-connect-sibling-cljs`)
5971

72+
A very common use-case would be to run `cider-jack-in-clj` for some project and then follow up with `cider-connect-sibling-cljs`.
73+
74+
NOTE: Unless there are both Clojure and ClojureScript REPLs in the same session smart-dispatch commands (e.g. evaluate the code
75+
in the right Clojure/ClojureScript REPL, toggle between Clojure and ClojureScript REPL) won't work. A very common problem
76+
newcomers experience is to create a Clojure REPL and a ClojureScript REPL in separate sessions and wonder why those are not
77+
interacting properly with one another.
78+
79+
=== Session Life-Cycle Management
80+
6081
Session life-cycle management commands live on the https://github.com/vspinu/sesman[Sesman] keymap (kbd:[C-c C-s])
6182

6283
* kbd:[C-c C-s s] (`sesman-start`)

0 commit comments

Comments
 (0)