-
Notifications
You must be signed in to change notification settings - Fork 18
Support (or document) cider-nrepl #60
Description
cider-nrepl is a collection of middleware that provides additional repl-options that can be used to provide rich editor/ide integrations. Cider is among the most widely used development environments for clojure, and it would be nice if gradle-clojure supported it through the clojureRepl task that launches an nrepl.
At this point, if you add a devRuntime "cider:cider-nrepl:0.16.0" dependency to your gradle-clojure build, the middleware still doesn't load in the nrepl instance launched by clojureRepl. Cider can connect to an nrepl instance mising the cider-nrepl middleware and provide a basic repl. But many other useful features fail. For example, if you attempt to run tests with the emacs command cider-test-run-ns-tests, cider sends a message with a 'test' option to the nrepl server, which is rejected with an invalid option error. Similarly if you attempt to jump to a function definition with the emacs command cider-find-var, an invalid option error is generated due to another missing feature provided by the cider-nrepl middleware.
According to the cider-nrepl documentation, it it possible to embed cider-nrepl in an arbitrary java application, but one must supply a handler to start-server:
(ns my-app
(:require [clojure.tools.nrepl.server :as nrepl-server]))
(defn nrepl-handler []
(require 'cider.nrepl)
(ns-resolve 'cider.nrepl 'cider-nrepl-handler))
(defn -main []
(nrepl-server/start-server :port 7888 :handler (nrepl-handler)))
I don't see gradle-clojure.tools.clojure-nrepl/start! providing any mechanism to supply such a handler to start-server: https://github.com/gradle-clojure/gradle-clojure/blob/8a28e84d0c774562c5b99948889f3993a9320518/modules/gradle-clojure-tools/src/main/clojure/gradle_clojure/tools/clojure_nrepl.clj#L7-L17 which makes me think that it's not currently possible to use cider with the nrepl that gradle-clojure launches.
Cider-nrepl itself provides mechanisms to add the middleware in boot projects and lein projects, but gradle-clojure doesn't seem to have a mechanism to hook into, and also seems to provide no mechanism that users can use to provide an arbitrary nrepl-middleware themselves.