Skip to content

Commit 2a0f25b

Browse files
committed
Add support for ls-middleware
1 parent c350f34 commit 2a0f25b

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Add first class support for Babashka (more warnings when you connect to `babashka.nrepl`).
88
* Add support for nREPL 0.8's `lookup` op.
99
* Add support for nREPL 0.7's sideloading functionality.
10+
* Add support for nREPL 0.8's `ls-middleware` op.
1011

1112
### Changes
1213

cider-connection.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,18 @@ REPL defaults to the current REPL."
469469
(mapc (lambda (op) (insert (format " * %s\n" op))) ops)))
470470
(display-buffer cider-nrepl-session-buffer))))
471471

472+
(defun cider-list-nrepl-middleware ()
473+
"List the loaded nREPL middleware."
474+
(interactive)
475+
(cider-ensure-connected)
476+
(let* ((repl (cider-current-repl nil 'ensure))
477+
(middleware (nrepl-middleware repl)))
478+
(with-current-buffer (cider-popup-buffer "*cider-nrepl-middleware*" 'select nil 'ancillary)
479+
(read-only-mode -1)
480+
(insert (format "Currently loaded middleware:\n"))
481+
(mapc (lambda (mw) (insert (format " * %s\n" mw))) middleware))
482+
(display-buffer "*cider-nrepl-middleware*")))
483+
472484

473485
;;; Sesman's Session-Wise Management UI
474486

cider-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ If invoked with a prefix ARG eval the expression after inserting it."
330330
["Close ancillary buffers" cider-close-ancillary-buffers
331331
:active (seq-remove #'null cider-ancillary-buffers)]
332332
("nREPL" :active (cider-connected-p)
333+
["List nREPL middleware" cider-list-nrepl-middleware]
333334
["Describe nREPL session" cider-describe-nrepl-session]
334335
["Toggle message logging" nrepl-toggle-message-logging]))
335336
"Menu for CIDER mode.")

nrepl-client.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ Optional argument TOOLING Tooling is set to t if wanting the tooling session fro
966966
"Perform :ls-sessions request for CONNECTION."
967967
(nrepl-send-sync-request '("op" "ls-sessions") connection))
968968

969+
(defun nrepl-sync-request:ls-middleware (connection)
970+
"Perform :ls-middleware request for CONNECTION."
971+
(nrepl-send-sync-request '("op" "ls-middleware") connection))
972+
969973
(defun nrepl-sync-request:eval (input connection &optional ns tooling)
970974
"Send the INPUT to the nREPL server synchronously.
971975
The request is dispatched via CONNECTION.
@@ -982,6 +986,10 @@ session."
982986
"Get a list of active sessions on the nREPL server using CONNECTION."
983987
(nrepl-dict-get (nrepl-sync-request:ls-sessions connection) "sessions"))
984988

989+
(defun nrepl-middleware (connection)
990+
"Get a list of middleware on the nREPL server using CONNECTION."
991+
(nrepl-dict-get (nrepl-sync-request:ls-middleware connection) "middleware"))
992+
985993

986994
;;; Server
987995

0 commit comments

Comments
 (0)