Skip to content

Commit 84a74ae

Browse files
committed
Added the Krell REPL support
This change adds the support for Krell REPL. Instead of having to pick a custom REPL and specifying a cider-custom-cljs-repl-init-form, this is all now included. All the user has to do is pick the REPL type, which in this case is krell.
1 parent 60c7d26 commit 84a74ae

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

cider.el

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,22 @@ Throws an error if PROJECT-TYPE is unknown."
357357
('gradle cider-gradle-global-options)
358358
(_ (user-error "Unsupported project type `%S'" project-type))))
359359

360+
(defun cider--clojure-cli-parameters ()
361+
(format cider-clojure-cli-parameters
362+
(concat
363+
"["
364+
(mapconcat
365+
(apply-partially #'format "\"%s\"")
366+
(cider-jack-in-normalized-nrepl-middlewares)
367+
", ")
368+
"]")))
369+
360370
(defun cider-jack-in-params (project-type)
361371
"Determine the commands params for `cider-jack-in' for the PROJECT-TYPE."
362372
(pcase project-type
363373
('lein cider-lein-parameters)
364374
('boot cider-boot-parameters)
365-
('clojure-cli (format cider-clojure-cli-parameters
366-
(concat
367-
"["
368-
(mapconcat
369-
(apply-partially #'format "\"%s\"")
370-
(cider-jack-in-normalized-nrepl-middlewares)
371-
", ")
372-
"]")))
375+
('clojure-cli (cider--clojure-cli-parameters))
373376
('shadow-cljs cider-shadow-cljs-parameters)
374377
('gradle cider-gradle-parameters)
375378
(_ (user-error "Unsupported project type `%S'" project-type))))
@@ -689,6 +692,12 @@ Generally you should not disable this unless you run into some faulty check."
689692
(unless (cider-library-present-p "adzerk.boot-cljs-repl")
690693
(user-error "The Boot ClojureScript REPL is not available. Please check https://github.com/adzerk-oss/boot-cljs-repl/blob/master/README.md for details")))
691694

695+
(defun cider-check-krell-requirements ()
696+
"Check whether we can start a Krell ClojureScript REPL."
697+
(cider-verify-piggieback-is-present)
698+
(unless (cider-library-present-p "krell.repl")
699+
(user-error "The Krell ClojureScript REPL is not available. Please check https://github.com/vouch-opensource/krell for details")))
700+
692701
(defun cider-check-shadow-cljs-requirements ()
693702
"Check whether we can start a shadow-cljs REPL."
694703
(unless (cider-library-present-p "shadow.cljs.devtools.api")
@@ -825,6 +834,15 @@ The supplied string will be wrapped in a do form if needed."
825834
cider-check-boot-requirements)
826835
(shadow cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements)
827836
(shadow-select cider-shadow-select-cljs-init-form cider-check-shadow-cljs-requirements)
837+
(krell "(require '[clojure.edn :as edn]
838+
'[clojure.java.io :as io]
839+
'[cider.piggieback]
840+
'[krell.api :as krell]
841+
'[krell.repl])
842+
(def config (edn/read-string (slurp (io/file \"build.edn\"))))
843+
(krell/build config)
844+
(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))"
845+
cider-check-krell-requirements)
828846
(custom cider-custom-cljs-repl-init-form nil))
829847
"A list of supported ClojureScript REPLs.
830848
@@ -867,6 +885,7 @@ you're working on."
867885
(const :tag "Boot" boot)
868886
(const :tag "Shadow" shadow)
869887
(const :tag "Shadow w/o Server" shadow-select)
888+
(const :tag "Krell" krell)
870889
(const :tag "Custom" custom))
871890
:group 'cider
872891
:safe #'symbolp

0 commit comments

Comments
 (0)