@@ -298,6 +298,26 @@ By default we favor the project-specific shadow-cljs over the system-wide."
298
298
:safe #'stringp
299
299
:package-version '(cider . " 1.14.0" ))
300
300
301
+ (defcustom cider-clr-command
302
+ " Cljr"
303
+ " The command used to execute ClojureCLR."
304
+ :type 'string
305
+ :safe #'stringp
306
+ :package-version '(cider . " 1.20.0" ))
307
+
308
+ (defcustom cider-clr-parameters
309
+ " -X clojure.tools.nrepl/start-server!"
310
+ " Params passed to ClojureCLR to start an nREPL server via `cider-jack-in' ."
311
+ :type 'string
312
+ :safe #'stringp
313
+ :package-version '(cider . " 1.20.0" ))
314
+
315
+ (defcustom cider-clr-nrepl-version " v0.1.2-alpha2"
316
+ " The version of clr.tools.nrepl injected on jack-in with ClojureCLR."
317
+ :type 'string
318
+ :safe #'stringp
319
+ :package-version '(cider . " 1.20.0" ))
320
+
301
321
(make-obsolete-variable 'cider-lein-global-options 'cider-lein-parameters " 1.8.0" )
302
322
(make-obsolete-variable 'cider-boot-command nil " 1.8.0" )
303
323
(make-obsolete-variable 'cider-boot-parameters nil " 1.8.0" )
@@ -325,7 +345,8 @@ to Leiningen."
325
345
(const gradle)
326
346
(const babashka)
327
347
(const nbb)
328
- (const basilisp))
348
+ (const basilisp)
349
+ (const clr))
329
350
:safe #'symbolp
330
351
:package-version '(cider . " 0.9.0" ))
331
352
@@ -346,6 +367,7 @@ command when there is no ambiguity."
346
367
(const babashka)
347
368
(const nbb)
348
369
(const basilisp)
370
+ (const clr)
349
371
(const :tag " Always ask" nil ))
350
372
:safe #'symbolp
351
373
:package-version '(cider . " 0.13.0" ))
@@ -419,7 +441,8 @@ Sub-match 1 must be the project path.")
419
441
(lein (:prefix-arg 2 :cmd (:jack-in-type clj :project-type lein :edit-project-dir t )))
420
442
(babashka (:prefix-arg 3 :cmd (:jack-in-type clj :project-type babashka :edit-project-dir t )))
421
443
(nbb (:prefix-arg 4 :cmd (:jack-in-type cljs :project-type nbb :cljs-repl-type nbb :edit-project-dir t )))
422
- (basilisp (:prefix-arg 5 :cmd (:jack-in-type clj :project-type basilisp :edit-project-dir t ))))
444
+ (basilisp (:prefix-arg 5 :cmd (:jack-in-type clj :project-type basilisp :edit-project-dir t )))
445
+ (clr (:prefix-arg 6 :cmd (:jack-in-type clr :project-type clr :edit-project-dir t ))))
423
446
" The list of project tools that are supported by the universal jack in command.
424
447
425
448
Each item in the list consists of the tool name and its plist options.
@@ -451,6 +474,7 @@ The plist supports the following keys
451
474
('gradle cider-gradle-command)
452
475
('nbb cider-nbb-command)
453
476
('basilisp cider-basilisp-command)
477
+ ('clr cider-clr-command)
454
478
(_ (user-error " Unsupported project type `%S' " project-type))))
455
479
456
480
(defcustom cider-enrich-classpath nil
@@ -482,6 +506,7 @@ Throws an error if PROJECT-TYPE is unknown."
482
506
; ; the exec-path
483
507
('gradle (cider--resolve-project-command cider-gradle-command))
484
508
('basilisp (cider--resolve-command cider-basilisp-command))
509
+ ('clr (cider--resolve-command cider-clr-command))
485
510
(_ (user-error " Unsupported project type `%S' " project-type))))
486
511
487
512
(defun cider-jack-in-global-options (project-type )
@@ -494,6 +519,7 @@ Throws an error if PROJECT-TYPE is unknown."
494
519
('gradle cider-gradle-global-options)
495
520
('nbb cider-nbb-global-options)
496
521
('basilisp nil )
522
+ ('clr nil )
497
523
(_ (user-error " Unsupported project type `%S' " project-type))))
498
524
499
525
(defun cider-jack-in-params (project-type )
@@ -510,6 +536,7 @@ Throws an error if PROJECT-TYPE is unknown."
510
536
('gradle cider-gradle-parameters)
511
537
('nbb cider-nbb-parameters)
512
538
('basilisp cider-basilisp-parameters)
539
+ ('clr cider-clr-parameters)
513
540
(_ (user-error " Unsupported project type `%S' " project-type))))
514
541
515
542
@@ -856,6 +883,32 @@ Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS."
856
883
" "
857
884
params)))
858
885
886
+ (defun cider-clr-jack-in-dependencies (params dependencies &optional command )
887
+ " Create ClojureCLR clr.core.cli jack-in dependencies.
888
+ Does so by concatenating DEPENDENCIES, and PARAMS into a
889
+ suitable `Cljr` invocation and quoting, also accounting for COMMAND if
890
+ provided."
891
+ (let* ((all-deps (thread-last dependencies
892
+ ; ; Duplicates are never OK since they would result in
893
+ ; ; `java.lang.IllegalArgumentException: Duplicate key [...]`:
894
+ (cider--dedupe-deps)
895
+ (seq-map (lambda (dep )
896
+ (if (listp (cadr dep))
897
+ (format " %s {%s }"
898
+ (car dep)
899
+ (seq-reduce
900
+ (lambda (acc v )
901
+ (concat acc (format " :%s \" %s \" " (car v) (cdr v))))
902
+ (cadr dep)
903
+ " " ))
904
+ (format " %s {:git/tag \" %s \" }" (car dep) (cadr dep)))))))
905
+ (deps (format " {:deps {%s }} "
906
+ (string-join all-deps " " )))
907
+ (deps-quoted (cider--shell-quote-argument deps command)))
908
+ (format " -Sdeps %s %s "
909
+ deps-quoted
910
+ (if params (format " %s " params) " " ))))
911
+
859
912
(defun cider-add-clojure-dependencies-maybe (dependencies )
860
913
" Return DEPENDENCIES with an added Clojure dependency if requested.
861
914
See also `cider-jack-in-auto-inject-clojure' ."
@@ -915,6 +968,10 @@ dependencies."
915
968
(unless (seq-empty-p global-opts) " " )
916
969
params))
917
970
('basilisp params)
971
+ ('clr (cider-clr-jack-in-dependencies
972
+ params
973
+ `((" io.github.clojure/clr.tools.nrepl" , cider-clr-nrepl-version ))
974
+ command))
918
975
(_ (error " Unsupported project type `%S' " project-type))))
919
976
920
977
@@ -2031,7 +2088,8 @@ PROJECT-DIR defaults to current project."
2031
2088
(gradle . " build.gradle" )
2032
2089
(gradle . " build.gradle.kts" )
2033
2090
(nbb . " nbb.edn" )
2034
- (basilisp . " basilisp.edn" ))))
2091
+ (basilisp . " basilisp.edn" )
2092
+ (clr . " deps-clr.edn" ))))
2035
2093
(delq nil
2036
2094
(mapcar (lambda (candidate )
2037
2095
(when (file-exists-p (cdr candidate))
0 commit comments