@@ -232,6 +232,9 @@ keep track of a namespace.
232
232
This should never be set in Clojure buffers, as there the namespace
233
233
should be extracted from the buffer's ns form." )
234
234
235
+ (defvar-local cider-repl-type nil
236
+ " The type of this REPL buffer, usually either \" clj\" or \" cljs\" ." )
237
+
235
238
(defun cider-ensure-op-supported (op )
236
239
" Check for support of middleware op OP.
237
240
Signal an error if it is not supported."
@@ -309,7 +312,10 @@ Signal an error if it is not supported."
309
312
Info contains project name, current REPL namespace, host:port
310
313
endpoint and Clojure version."
311
314
(with-current-buffer (get-buffer connection-buffer)
312
- (format " Active nREPL connection: %s @%s :%s (Java %s , Clojure %s , nREPL %s ) "
315
+ (format " Active nREPL connection: %s%s @%s :%s (Java %s , Clojure %s , nREPL %s ) "
316
+ (if nrepl-sibling-buffer-alist
317
+ (upcase (concat cider-repl-type " " ))
318
+ " " )
313
319
(or (nrepl--project-name nrepl-project-dir) " <no project>" )
314
320
(car nrepl-endpoint)
315
321
(cadr nrepl-endpoint)
@@ -320,7 +326,7 @@ endpoint and Clojure version."
320
326
(defun cider-display-current-connection-info ()
321
327
" Display information about the current connection."
322
328
(interactive )
323
- (message (cider--connection-info (nrepl -current-connection -buffer))))
329
+ (message (cider--connection-info (cider -current-repl -buffer))))
324
330
325
331
(defun cider-rotate-connection ()
326
332
" Rotate and display the current nREPL connection."
@@ -491,7 +497,7 @@ supplied project directory."
491
497
(format (if connection-buffer
492
498
" Switched to REPL: %s"
493
499
" Could not determine relevant nREPL connection, using: %s" )
494
- (with-current-buffer (nrepl -current-connection -buffer)
500
+ (with-current-buffer (cider -current-repl -buffer)
495
501
(format " %s :%s , %s :%s "
496
502
(or (nrepl--project-name nrepl-project-dir) " <no project>" )
497
503
cider-buffer-ns
@@ -1637,13 +1643,13 @@ form independently.")
1637
1643
1638
1644
(defun cider--cache-ns-form ()
1639
1645
" Cache the form in the current buffer for the current connection."
1640
- (puthash (nrepl -current-connection -buffer)
1646
+ (puthash (cider -current-repl -buffer)
1641
1647
(cider-ns-form)
1642
1648
cider--ns-form-cache))
1643
1649
1644
1650
(defun cider--cached-ns-form ()
1645
1651
" Retrieve the cached ns form for the current buffer & connection."
1646
- (gethash (nrepl -current-connection -buffer) cider--ns-form-cache))
1652
+ (gethash (cider -current-repl -buffer) cider--ns-form-cache))
1647
1653
1648
1654
(defun cider--prep-interactive-eval (form )
1649
1655
" Prepares the environment for an interactive eval of FORM.
@@ -1685,7 +1691,7 @@ arguments and only proceed with evaluation if it returns nil."
1685
1691
; ; always eval ns forms in the user namespace
1686
1692
; ; otherwise trying to eval ns form for the first time will produce an error
1687
1693
(if (cider-ns-form-p form) " user" (cider-current-ns))
1688
- nil
1694
+ (cider-current-session)
1689
1695
point)))
1690
1696
1691
1697
(defun cider-interactive-pprint-eval (form &optional callback right-margin )
@@ -1722,7 +1728,7 @@ If invoked with a PREFIX argument, print the result in the current buffer."
1722
1728
(interactive )
1723
1729
(let ((last-sexp (cider-last-sexp)))
1724
1730
; ; we have to be sure the evaluation won't result in an error
1725
- (nrepl-sync-request:eval last-sexp)
1731
+ (nrepl-sync-request:eval last-sexp nil (cider-current-session) )
1726
1732
; ; seems like the sexp is valid, so we can safely kill it
1727
1733
(backward-kill-sexp )
1728
1734
(cider-interactive-eval last-sexp (cider-eval-print-handler))))
@@ -1845,7 +1851,10 @@ If invoked with a prefix ARG eval the expression after inserting it."
1845
1851
(defun cider-ping ()
1846
1852
" Check that communication with the nREPL server works."
1847
1853
(interactive )
1848
- (message (read (nrepl-dict-get (nrepl-sync-request:eval " \" PONG\" " ) " value" ))))
1854
+ (-> (nrepl-sync-request:eval " \" PONG\" " nil (cider-current-session))
1855
+ (nrepl-dict-get " value" )
1856
+ (read )
1857
+ (message )))
1849
1858
1850
1859
(defun cider-connected-p ()
1851
1860
" Return t if CIDER is currently connected, nil otherwise."
@@ -2160,6 +2169,10 @@ the string contents of the region into a formatted string."
2160
2169
; ;; quiting
2161
2170
(defun cider--close-buffer (buffer )
2162
2171
" Close the BUFFER and kill its associated process (if any)."
2172
+ (when nrepl-session
2173
+ (nrepl-sync-request:close nrepl-session))
2174
+ (when nrepl-tooling-session
2175
+ (nrepl-sync-request:close nrepl-tooling-session))
2163
2176
(when (get-buffer-process buffer)
2164
2177
(delete-process (get-buffer-process buffer)))
2165
2178
(when (get-buffer buffer)
@@ -2192,7 +2205,7 @@ and all ancillary CIDER buffers."
2192
2205
(dolist (connection nrepl-connection-list)
2193
2206
(cider--quit-connection connection))
2194
2207
(message " All active nREPL connections were closed " ))
2195
- (cider--quit-connection (nrepl -current-connection -buffer)))
2208
+ (cider--quit-connection (cider -current-repl -buffer)))
2196
2209
; ; if there are no more connections we can kill all ancillary buffers
2197
2210
(unless (cider-connected-p)
2198
2211
(cider-close-ancillary-buffers))))
@@ -2217,7 +2230,7 @@ If RESTART-ALL is t, then restarts all connections."
2217
2230
(if restart-all
2218
2231
(dolist (conn nrepl-connection-list)
2219
2232
(cider--restart-connection conn))
2220
- (cider--restart-connection (nrepl -current-connection -buffer))))
2233
+ (cider--restart-connection (cider -current-repl -buffer))))
2221
2234
2222
2235
(defvar cider--namespace-history nil
2223
2236
" History of user input for namespace prompts." )
0 commit comments