Open
Description
nREPL now has dynamic insertion of middleware, as well a sideloader for requesting resources from the client. CIDER has basic support for sideloading, so it would seem that all the pieces are there to be able to take a vanilla nREPL connection, and upgrade it to a fully CIDER-compliant connection.
After initial testing it seems this isn't quite there yet, there are small tweaks needed in CIDER, cider-nrepl, and nREPL, so this is a meta-issue to keep track of the overall goal and progress.
- Sideloader: no line breaks in base64 content #3038
- Allow starting the sideloader for the tooling session #3039
- Sideloader state in session nrepl/nrepl#243
- Use session classloader when loading deferred middleware cider-nrepl#705
- Sideloader: handle binary files, support multiple directories #3041
- Log errors that happen when loading dynamic middleware nrepl/nrepl#244
- Dynamically upgrade nrepl connection #3044
- Sideloader+dynload dogfooding nrepl/nrepl#246
Related
How to try it out
Start a vanilla nREPL server:
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0-beta1"}}}' -M: -m nrepl.cmdline --port 1234
Connect to it from Emacs:
(setq
;; Make sure we can inspect the nREPL traffic
nrepl-log-messages t
;; Prevent the nrepl pprint middleware from looking for a print function that
;; isn't (yet) there. Not necessary but prevents some noise.
cider-print-fn nil
;; Use the cider-nrepl jar that I `make install'ed locally
;; we need the classloader-related fixes in the deferred middleware
cider-dynload-cider-nrepl-version "0.27.0-SNAPSHOT"
;; Make sure caching doesn't bite us
cider-jar-content-cache (make-hash-table :test #'equal))
;; Start the connection
(cider-nrepl-connect
'( :project-dir "/home/arne/clj-projects/timezoner"
:host "localhost"
:port 1234
:repl-init-function nil
:session-name nil
:repl-type clj))
;; Go to a clojure or cider repl buffer and do
;; M-x cider-upgrade-nrepl-connection