Skip to content

Commit 4ba36bc

Browse files
committed
Add support for babashka projects to cider-jack-in
1 parent 6a17686 commit 4ba36bc

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Make it possible to specify the version of `cider-nrepl` to use with `cider-jack-in`. See `cider-injected-middleware-version`.
1111
* Make it possible to specify the version of nREPL to use with `cider-jack-in`. See `cider-injected-nrepl-version`.
1212
* Upgrade `cider-nrepl`, `Orchard` and `clj-suitable` for pulling their latest bugfixes.
13+
* Add support for babaska projects to `cider-jack-in`.
1314

1415
### Bugs fixed
1516

cider.el

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,30 @@ By default we favor the project-specific shadow-cljs over the system-wide."
226226
:safe #'stringp
227227
:package-version '(cider . "0.10.0"))
228228

229+
(defcustom cider-babashka-command
230+
"bb"
231+
"The command used to execute Babashka."
232+
:type 'string
233+
:group 'cider
234+
:safe #'stringp
235+
:package-version '(cider . "1.2.0"))
236+
237+
(defcustom cider-babashka-global-options
238+
nil
239+
"Command line options used to execute Babashka."
240+
:type 'string
241+
:group 'cider
242+
:safe #'stringp
243+
:package-version '(cider . "1.2.0"))
244+
245+
(defcustom cider-babashka-parameters
246+
"nrepl-server"
247+
"Params passed to babashka to start an nREPL server via `cider-jack-in'."
248+
:type 'string
249+
:group 'cider
250+
:safe #'stringp
251+
:package-version '(cider . "1.2.0"))
252+
229253
(defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein)
230254
"The default tool to use when doing `cider-jack-in' outside a project.
231255
This value will only be consulted when no identifying file types, i.e.
@@ -238,7 +262,8 @@ to Leiningen."
238262
(const boot)
239263
(const clojure-cli)
240264
(const shadow-cljs)
241-
(const gradle))
265+
(const gradle)
266+
(const babashka))
242267
:group 'cider
243268
:safe #'symbolp
244269
:package-version '(cider . "0.9.0"))
@@ -257,6 +282,7 @@ command when there is no ambiguity."
257282
(const clojure-cli)
258283
(const shadow-cljs)
259284
(const gradle)
285+
(const babashka)
260286
(const :tag "Always ask" nil))
261287
:group 'cider
262288
:safe #'symbolp
@@ -333,6 +359,7 @@ Sub-match 1 must be the project path.")
333359
('lein cider-lein-command)
334360
('boot cider-boot-command)
335361
('clojure-cli cider-clojure-cli-command)
362+
('babashka cider-babashka-command)
336363
('shadow-cljs cider-shadow-cljs-command)
337364
('gradle cider-gradle-command)
338365
(_ (user-error "Unsupported project type `%S'" project-type))))
@@ -344,6 +371,7 @@ Throws an error if PROJECT-TYPE is unknown."
344371
('lein (cider--resolve-command cider-lein-command))
345372
('boot (cider--resolve-command cider-boot-command))
346373
('clojure-cli (cider--resolve-command cider-clojure-cli-command))
374+
('babashka (cider--resolve-command cider-babashka-command))
347375
;; here we have to account for the possibility that the command is either
348376
;; "npx shadow-cljs" or just "shadow-cljs"
349377
('shadow-cljs (let ((parts (split-string cider-shadow-cljs-command)))
@@ -358,6 +386,7 @@ Throws an error if PROJECT-TYPE is unknown."
358386
('lein cider-lein-global-options)
359387
('boot cider-boot-global-options)
360388
('clojure-cli cider-clojure-cli-global-options)
389+
('babashka cider-babashka-global-options)
361390
('shadow-cljs cider-shadow-cljs-global-options)
362391
('gradle cider-gradle-global-options)
363392
(_ (user-error "Unsupported project type `%S'" project-type))))
@@ -372,6 +401,7 @@ Throws an error if PROJECT-TYPE is unknown."
372401
('lein cider-lein-parameters)
373402
('boot cider-boot-parameters)
374403
('clojure-cli nil)
404+
('babashka cider-babashka-parameters)
375405
('shadow-cljs cider-shadow-cljs-parameters)
376406
('gradle cider-gradle-parameters)
377407
(_ (user-error "Unsupported project type `%S'" project-type))))
@@ -658,6 +688,10 @@ dependencies."
658688
params
659689
(cider-add-clojure-dependencies-maybe
660690
cider-jack-in-dependencies)))
691+
('babashka (concat
692+
global-opts
693+
(unless (seq-empty-p global-opts) " ")
694+
params))
661695
('shadow-cljs (cider-shadow-cljs-jack-in-dependencies
662696
global-opts
663697
params
@@ -1522,6 +1556,7 @@ PROJECT-DIR defaults to current project."
15221556
(build-files '((lein . "project.clj")
15231557
(boot . "build.boot")
15241558
(clojure-cli . "deps.edn")
1559+
(babashka . "bb.edn")
15251560
(shadow-cljs . "shadow-cljs.edn")
15261561
(gradle . "build.gradle")
15271562
(gradle . "build.gradle.kts"))))

0 commit comments

Comments
 (0)