Skip to content

Commit f564181

Browse files
authored
Restore xref-based jump-to-definition in Babashka (#3460)
Fixes #3456
1 parent 5718f13 commit f564181

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [#3250](https://github.com/clojure-emacs/cider/issues/3250): don't lose the CIDER session over TRAMP files.
3333
- [#3413](https://github.com/clojure-emacs/cider/issues/3413): Make jump-to-definition work in projects needing `cider-path-translations` (i.e. Dockerized projects).
3434
- [#2436](https://github.com/clojure-emacs/cider/issues/2436): Prevent malformed `cider-repl-history-file`s from failing `cider-jack-in`.
35+
- [#3456](https://github.com/clojure-emacs/cider/issues/3456): restore xref-based jump-to-definition in Babashka (and any nREPL clients not having cider-nrepl).
3536
- Fix the `xref-find-definitions` CIDER backend to return correct filenames.
3637
- Fix the `cider-xref-fn-deps` buttons to direct to the right file.
3738
- Fix the `cider-find-keyword` overall reliability and correctness, particularly for ClojureScript.

cider-xref-backend.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
"Used for xref integration."
4343
;; Check if `cider-nrepl` middleware is loaded. Allows fallback to other xref
4444
;; backends, if cider-nrepl is not loaded.
45-
(when (cider-nrepl-op-supported-p "ns-path" nil 'skip-ensure)
45+
(when (or
46+
;; the main requirement:
47+
(cider-nrepl-op-supported-p "ns-path" nil 'skip-ensure)
48+
;; the fallback, used for bare nrepl or babashka integrations:
49+
(cider-nrepl-op-supported-p "lookup" nil 'skip-ensure))
4650
'cider))
4751

4852
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql cider)))
@@ -91,7 +95,6 @@ These are used for presentation purposes."
9195
(cl-defmethod xref-backend-definitions ((_backend (eql cider)) var)
9296
"Find definitions of VAR."
9397
(cider-ensure-connected)
94-
(cider-ensure-op-supported "ns-path")
9598
(when-let* ((loc (cider--var-to-xref-location var)))
9699
(list (xref-make var loc))))
97100

0 commit comments

Comments
 (0)