Skip to content

Commit 42e3cba

Browse files
alexander-yakushevbbatsov
authored andcommitted
Remove enrich-classpath support from cider-jack-in
1 parent 12f10a6 commit 42e3cba

File tree

12 files changed

+28
-346
lines changed

12 files changed

+28
-346
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ jobs:
106106
# problem by rerunning the tests more than once.
107107
eldev -p -dtTC test --test-type integration || eldev -p -dtTC test --test-type integration
108108
109-
- name: Run tests that need enrich-classpath
110-
if: "!startsWith(matrix.os, 'windows')"
111-
run: |
112-
cd dev; ../clojure.sh clojure -M:gen; cd -
113-
wc -l test/File.edn
114-
eldev -p -dtTC test --test-type enrich || eldev -p -dtTC test --test-type enrich
115-
116109
- name: Test clojure-ts-mode
117110
if: startsWith (matrix.emacs_version, '30')
118111
run: |

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## master (unreleased)
44

5+
### New features
6+
7+
### Changes
8+
9+
- [#3816](https://github.com/clojure-emacs/cider/issues/3816): **(Breaking)** Remove enrich-classpath support from cider-jack-in.
10+
11+
### Bugs fixed
12+
513
## 1.18.0 (2025-04-30)
614

715
### New features

Eldev

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
(eldev-pcase-exhaustive cider-test-type
2626
(`main "./test/*/")
2727
(`integration '("./test/" "!./test/integration"))
28-
(`enrich '("./test/" "!./test/enrich"))
2928
(`clojure-ts-mode '("./test/*/" "!./test/clojure-ts-mode"))
3029
(`all '("./test/*/" "!./test/integration")))
3130
"test/integration/projects"
@@ -34,12 +33,12 @@
3433
"test/cider-tests--no-auto.el"))
3534

3635
(eldev-defoption cider-test-selection (type)
37-
"Select tests to run; type can be `main', `integration', `enrich', `clojure-ts-mode' or `all'"
36+
"Select tests to run; type can be `main', `integration', `clojure-ts-mode' or `all'"
3837
:options (-T --test-type)
3938
:for-command test
4039
:value TYPE
4140
:default-value cider-test-type
42-
(unless (memq (intern type) '(main integration enrich clojure-ts-mode all))
41+
(unless (memq (intern type) '(main integration clojure-ts-mode all))
4342
(signal 'eldev-wrong-option-usage `("unknown test type `%s'" ,type)))
4443
(setf cider-test-type (intern type)))
4544

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@ lint: clean
1919
compile: clean
2020
eldev -dtT compile --warnings-as-errors
2121

22-
test/File.edn:
23-
cd dev; ../clojure.sh clojure -M:gen
24-
25-
test-all: clean test/File.edn
22+
test-all: clean
2623
eldev -dtT -p test --test-type all
2724

28-
test-enrich: clean test/File.edn
29-
eldev -dtT -p test --test-type enrich
30-
3125
test-integration: clean
3226
eldev -dtT -p test --test-type integration
3327

cider-client.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ The default value in nREPL is 1024."
339339
:group 'cider
340340
:package-version '(cider . "0.25.0"))
341341

342-
(defcustom cider-download-java-sources nil
342+
(defcustom cider-download-java-sources t
343343
"Whether to automatically download source artifacts for 3rd-party Java classes.
344344
345345
When enabled, CIDER will attempt to download source JARs from Maven for

cider.el

Lines changed: 9 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ By default we favor the project-specific shadow-cljs over the system-wide."
307307
(make-obsolete-variable 'cider-gradle-global-options 'cider-gradle-parameters "1.8.0")
308308
(make-obsolete-variable 'cider-babashka-global-options 'cider-babashka-parameters "1.8.0")
309309
(make-obsolete-variable 'cider-nbb-global-options 'cider-nbb-parameters "1.8.0")
310+
(make-obsolete-variable 'cider-enrich-classpath nil "1.19.0")
310311

311312
(defcustom cider-jack-in-default
312313
(if (executable-find "clojure") 'clojure-cli 'lein)
@@ -453,49 +454,16 @@ The plist supports the following keys
453454
(_ (user-error "Unsupported project type `%S'" project-type))))
454455

455456
(defcustom cider-enrich-classpath nil
456-
"If t, use enrich-classpath for adding sources/javadocs to the classpath.
457-
458-
enrich-classpath is a Clojure CLI shim, and Leiningen plugin.
459-
460-
This classpath expansion is done in a clean manner,
461-
without interfering with classloaders."
457+
"Removed."
462458
:type 'boolean
463-
:package-version '(cider . "1.2.0")
464459
:safe #'booleanp)
465460

466-
(defun cider--get-enrich-classpath-lein-script ()
467-
"Returns the location of enrich-classpath's lein.sh wrapper script."
468-
(when-let ((cider-location (locate-library "cider.el" t)))
469-
(concat (file-name-directory cider-location)
470-
"lein.sh")))
471-
472-
(defun cider--get-enrich-classpath-clojure-cli-script ()
473-
"Returns the location of enrich-classpath's clojure.sh wrapper script."
474-
(when-let ((cider-location (locate-library "cider.el" t)))
475-
(concat (file-name-directory cider-location)
476-
"clojure.sh")))
477-
478461
(defun cider-jack-in-resolve-command (project-type)
479462
"Determine the resolved file path to `cider-jack-in-command'.
480463
Throws an error if PROJECT-TYPE is unknown."
481464
(pcase project-type
482-
('lein (let ((r (cider--resolve-command cider-lein-command)))
483-
(if (and cider-enrich-classpath
484-
(not (eq system-type 'windows-nt))
485-
(executable-find (cider--get-enrich-classpath-lein-script)))
486-
(concat "bash " ;; don't assume lein.sh is executable - MELPA might change that
487-
(cider--get-enrich-classpath-lein-script)
488-
" "
489-
r)
490-
r)))
491-
('clojure-cli (if (and cider-enrich-classpath
492-
(not (eq system-type 'windows-nt))
493-
(executable-find (cider--get-enrich-classpath-clojure-cli-script)))
494-
(concat "bash " ;; don't assume clojure.sh is executable - MELPA might change that
495-
(cider--get-enrich-classpath-clojure-cli-script)
496-
" "
497-
(cider--resolve-command cider-clojure-cli-command))
498-
(cider--resolve-command cider-clojure-cli-command)))
465+
('lein (cider--resolve-command cider-lein-command))
466+
('clojure-cli (cider--resolve-command cider-clojure-cli-command))
499467
('babashka (cider--resolve-command cider-babashka-command))
500468
;; here we have to account for the possibility that the command is either
501469
;; "npx shadow-cljs" or just "shadow-cljs"
@@ -649,12 +617,8 @@ Added to `cider-jack-in-lein-plugins' (which see) when doing
649617
"Return a normalized list of Leiningen plugins to be injected.
650618
See `cider-jack-in-lein-plugins' for the format, except that the list
651619
returned by this function does not include keyword arguments."
652-
(let ((plugins (if cider-enrich-classpath
653-
(append cider-jack-in-lein-plugins
654-
`(("cider/cider-nrepl" ,cider-injected-middleware-version)
655-
("mx.cider/lein-enrich-classpath" "1.19.3")))
656-
(append cider-jack-in-lein-plugins
657-
`(("cider/cider-nrepl" ,cider-injected-middleware-version))))))
620+
(let ((plugins (append cider-jack-in-lein-plugins
621+
`(("cider/cider-nrepl" ,cider-injected-middleware-version)))))
658622
(thread-last plugins
659623
(seq-filter
660624
(lambda (spec)
@@ -765,18 +729,6 @@ of EXCLUSIONS can be provided as well. The returned
765729
string is quoted for passing as argument to an inferior shell."
766730
(shell-quote-argument (format "[%s %S%s]" (car list) (cadr list) (cider--lein-artifact-exclusions exclusions))))
767731

768-
(defun cider--extract-lein-profiles (lein-params)
769-
"Extracts a list of ('with-profile ...' and a repl command from LEIN-PARAMS).
770-
771-
If no `with-profile' call was found,
772-
returns an empty string as the first member."
773-
(or (when-let* ((pattern "\\(with-profiles?\\s-+\\S-+\\)")
774-
(match-start (string-match pattern lein-params))
775-
(match-end (match-end 0)))
776-
(list (concat (substring lein-params match-start match-end) " ")
777-
(string-trim (substring lein-params match-end))))
778-
(list "" lein-params)))
779-
780732
(defun cider-lein-jack-in-dependencies (global-opts params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares)
781733
"Create lein jack-in dependencies.
782734
Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS
@@ -802,16 +754,7 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS."
802754
`(,(concat "update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'"))))
803755
" -- ")
804756
" -- "
805-
(if (not cider-enrich-classpath)
806-
params
807-
;; enrich-classpath must be applied after the `with-profile` call, if present,
808-
;; so that it can also process the classpath that is typically expanded by the presence of a set of profiles:
809-
(let* ((profiles-and-repl-call (cider--extract-lein-profiles params))
810-
(profiles (car profiles-and-repl-call))
811-
(repl-call (nth 1 profiles-and-repl-call)))
812-
(concat profiles
813-
"update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- "
814-
repl-call)))))
757+
params))
815758

816759
(defun cider--dedupe-deps (deps)
817760
"Removes the duplicates in DEPS."
@@ -1404,8 +1347,7 @@ With the prefix argument,
14041347
allow editing of the jack in command; with a double prefix prompt for all
14051348
these parameters."
14061349
(interactive "P")
1407-
(let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now
1408-
(cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies))
1350+
(let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies))
14091351
(cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins))
14101352
(cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares))
14111353
(orig-buffer (current-buffer)))
@@ -1433,8 +1375,7 @@ with a double prefix prompt for all these parameters.
14331375
When SOFT-CLJS-START is non-nil, start cljs REPL
14341376
only when the ClojureScript dependencies are met."
14351377
(interactive "P")
1436-
(let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now
1437-
(cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies))
1378+
(let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies))
14381379
(cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins))
14391380
(cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares))
14401381
(orig-buffer (current-buffer)))

clojure.sh

Lines changed: 0 additions & 54 deletions
This file was deleted.

doc/modules/ROOT/pages/config/basic_config.adoc

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,6 @@ buffers. You can override this behavior, however:
2727
(setq cider-auto-mode nil)
2828
----
2929

30-
== Use `enrich-classpath`
31-
32-
https://github.com/clojure-emacs/enrich-classpath[`enrich-classpath`] is a program/plugin/wrapper that allows CIDER to access to the sources and javadocs of a given project's Java files: your own files, those from your dependencies, and those from the JDK.
33-
34-
With that, CIDER can show better completions, navigation, documentation, stacktrace and Inspector integration.
35-
36-
For Lein users, it has the additional benefit of running a single JVM, instead of the two JVMs that Lein programs typically involve.
37-
38-
NOTE: `enrich-classpath` is still in beta and defaults to being disabled.
39-
40-
You can enable it by setting the `cider-enrich-classpath` defcustom to `t`.
41-
42-
With it enabled, `cider-jack-in` will activate enrich-classpath, given the following conditions:
43-
44-
* You are on macOS/Linux
45-
* You are launching a vanilla JVM repl (and not a cljs repl, or a clj+cljs repl)
46-
* You are using `cider-jack-in` / `cider-jack-in-clj` (and not `cider-connect`)
47-
** For `cider-connect`, please follow enrich-classpath's https://github.com/clojure-emacs/enrich-classpath/tree/v1.19.3#emacs-cider-connect[own instructions].
48-
49-
...these conditions will be progressively relaxed.
50-
51-
It's worth noting that `cider-jack-in` will fall back to the original command if enrich-classpath failed, for whatever reason.
52-
5330
== Prompt for Symbol Confirmation
5431

5532
NOTE: The default here was changed in CIDER 1.0.

doc/modules/ROOT/pages/troubleshooting.adoc

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -295,35 +295,24 @@ Or by customising the jack-in options.
295295

296296
NOTE: Leiningen disables `OmitStackTraceInFastThrow` by default.
297297

298-
=== Errors Related to enrich-classpath
299-
300-
If you get any errors related to `enrich-classpath` when doing `cider-jack-in`, you can disable
301-
the `enrich-classpath` integration like this:
302-
303-
[source,lisp]
304-
----
305-
(setq cider-enrich-classpath nil)
306-
----
307-
308298
=== Navigation to JDK sources doesn't work
309299

310-
Firstly, make sure that you are using enrich-classpath. `cider-enrich-classpath` should be truthy.
311-
If you are launching your own repl process, it should run through enrich-classpath's `lein` wrapper, or `clojure` wrapper.
300+
If you try to navigate to the sources of third-party Java libraries, make sure
301+
that the variable `cider-download-java-sources` is set to `t`.
312302

313303
If you are on Linux and still can't navigate to the source of built-in methods like `.toUpperCase` you
314-
probably haven't installed the JDK sources. While you're at it - it's good to
315-
install the JDK's Javadocs as well. On Debian/Ubuntu:
304+
probably haven't installed the JDK sources. On Debian/Ubuntu:
316305

317306
[source,shell]
318307
----
319-
$ sudo apt install openjdk-17-source openjdk-17-doc
308+
$ sudo apt install openjdk-21-source openjdk-21-doc
320309
----
321310

322311
On Red Hat/Fedora/CentOS:
323312

324313
[source,shell]
325314
----
326-
$ sudo dnf install java-17-openjdk-src java-17-openjdk-javadoc
315+
$ sudo dnf install java-21-openjdk-src java-21-openjdk-javadoc
327316
----
328317

329318
On Guix:

lein.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)