@@ -164,6 +164,29 @@ version from the CIDER package or library.")
164
164
:safe #'stringp
165
165
:package-version '(cider . " 0.17.0" ))
166
166
167
+ (defcustom cider-shadow-cljs-command
168
+ " shadow-cljs"
169
+ " The command used to execute shadow-cljs."
170
+ :type 'string
171
+ :group 'cider
172
+ :package-version '(cider . " 0.17.0" ))
173
+
174
+ (defcustom cider-shadow-cljs-global-options
175
+ " "
176
+ " Command line options used to execute shadow-cljs (e.g.: -v for verbose mode)."
177
+ :type 'string
178
+ :group 'cider
179
+ :safe #'stringp
180
+ :package-version '(cider . " 0.17.0" ))
181
+
182
+ (defcustom cider-shadow-cljs-parameters
183
+ " server"
184
+ " Params passed to shadow-cljs to start an nREPL server via `cider-jack-in' ."
185
+ :type 'string
186
+ :group 'cider
187
+ :safe #'stringp
188
+ :package-version '(cider . " 0.17.0" ))
189
+
167
190
(defcustom cider-gradle-command
168
191
" gradle"
169
192
" The command used to execute Gradle."
@@ -211,6 +234,7 @@ command when there is no ambiguity."
211
234
:type '(choice (const " lein" )
212
235
(const " boot" )
213
236
(const " clojure" )
237
+ (const " shadow-cljs" )
214
238
(const " gradle" )
215
239
(const :tag " Always ask" nil ))
216
240
:group 'cider
@@ -292,6 +316,7 @@ Sub-match 1 must be the project path.")
292
316
(" lein" cider-lein-command)
293
317
(" boot" cider-boot-command)
294
318
(" clojure" cider-clojure-cli-command)
319
+ (" shadow-cljs" cider-shadow-cljs-command)
295
320
(" gradle" cider-gradle-command)
296
321
(_ (user-error " Unsupported project type `%s' " project-type))))
297
322
@@ -303,6 +328,7 @@ Throws an error if PROJECT-TYPE is unknown. Known types are
303
328
(" lein" (cider--lein-resolve-command))
304
329
(" boot" (cider--boot-resolve-command))
305
330
(" clojure" (cider--clojure-cli-resolve-command))
331
+ (" shadow-cljs" (cider--shadow-cljs-resolve-command))
306
332
(" gradle" (cider--gradle-resolve-command))
307
333
(_ (user-error " Unsupported project type `%s' " project-type))))
308
334
@@ -312,6 +338,7 @@ Throws an error if PROJECT-TYPE is unknown. Known types are
312
338
(" lein" cider-lein-global-options)
313
339
(" boot" cider-boot-global-options)
314
340
(" clojure" cider-clojure-cli-global-options)
341
+ (" shadow-cljs" cider-shadow-cljs-global-options)
315
342
(" gradle" cider-gradle-global-options)
316
343
(_ (user-error " Unsupported project type `%s' " project-type))))
317
344
@@ -321,6 +348,7 @@ Throws an error if PROJECT-TYPE is unknown. Known types are
321
348
(" lein" cider-lein-parameters)
322
349
(" boot" cider-boot-parameters)
323
350
(" clojure" cider-clojure-cli-parameters)
351
+ (" shadow-cljs" cider-shadow-cljs-parameters)
324
352
(" gradle" cider-gradle-parameters)
325
353
(_ (user-error " Unsupported project type `%s' " project-type))))
326
354
@@ -450,6 +478,20 @@ Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS."
450
478
" }}' "
451
479
params)))
452
480
481
+ (defun cider-shadow-cljs-jack-in-dependencies (global-opts params dependencies )
482
+ " Create shadow-cljs jack-in deps.
483
+ Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS."
484
+ (let ((dependencies (append dependencies
485
+ `((" cider/cider-nrepl" ,(upcase cider-version))))))
486
+ (concat
487
+ global-opts
488
+ (unless (seq-empty-p global-opts) " " )
489
+ (mapconcat #'identity
490
+ (seq-map (lambda (dep ) (format " -d %s :%s " (car dep) (cadr dep))) dependencies)
491
+ " " )
492
+ " "
493
+ params)))
494
+
453
495
(defun cider-add-clojure-dependencies-maybe (dependencies )
454
496
" Return DEPENDENCIES with an added Clojure dependency if requested.
455
497
@@ -495,6 +537,11 @@ dependencies."
495
537
params
496
538
(cider-add-clojure-dependencies-maybe
497
539
cider-jack-in-dependencies)))
540
+ (" shadow-cljs" (cider-shadow-cljs-jack-in-dependencies
541
+ global-opts
542
+ params
543
+ (cider-add-clojure-dependencies-maybe
544
+ cider-jack-in-dependencies)))
498
545
(" gradle" (concat
499
546
global-opts
500
547
(unless (seq-empty-p global-opts) " " )
@@ -902,6 +949,7 @@ Use `cider-ps-running-nrepls-command' and `cider-ps-running-nrepl-path-regexp-li
902
949
(build-files '((" lein" . " project.clj" )
903
950
(" boot" . " build.boot" )
904
951
(" clojure" . " deps.edn" )
952
+ (" shadow-cljs" . " shadow-cljs.edn" )
905
953
(" gradle" . " build.gradle" ))))
906
954
(delq nil
907
955
(mapcar (lambda (candidate )
@@ -968,6 +1016,16 @@ In case `default-directory' is non-local we assume the command is available."
968
1016
(executable-find (concat cider-clojure-cli-command " .exe" )))))
969
1017
(shell-quote-argument command)))
970
1018
1019
+ ; ; TODO: Implement a check for `cider-shadow-cljs-command' over tramp
1020
+ (defun cider--shadow-cljs-resolve-command ()
1021
+ " Find `cider-shadow-cljs-command' on `exec-path' if possible, or return nil.
1022
+
1023
+ In case `default-directory' is non-local we assume the command is available."
1024
+ (when-let* ((command (or (and (file-remote-p default-directory) cider-shadow-cljs-command)
1025
+ (executable-find cider-shadow-cljs-command)
1026
+ (executable-find (concat cider-shadow-cljs-command " .exe" )))))
1027
+ (shell-quote-argument command)))
1028
+
971
1029
972
1030
; ;; Check that the connection is working well
973
1031
; ; TODO: This is nrepl specific. It should eventually go into some cider-nrepl-client
0 commit comments