Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore xref-based jump-to-definition in Babashka #3460

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

vemv
Copy link
Member

@vemv vemv commented Sep 11, 2023

Fixes #3456

I tested this one locally by cider-connecting to a lein repl session without cider-nrepl in it.

M-x xref-find-definitions now works (and does not work without this patch applied).

Cheers - V

@@ -91,7 +95,6 @@ These are used for presentation purposes."
(cl-defmethod xref-backend-definitions ((_backend (eql cider)) var)
"Find definitions of VAR."
(cider-ensure-connected)
(cider-ensure-op-supported "ns-path")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We weren't actually using ns-path under this code path.

We only hit cider-var-info, which looks like this:

(defun cider-var-info (var &optional all)
  "Return VAR's info as an alist with list cdrs.
When multiple matching vars are returned you'll be prompted to select one,
unless ALL is truthy."
  (when (and var (not (string= var "")))
    (let ((var-info (cond
                     ((cider-nrepl-op-supported-p "info") (cider-sync-request:info var))
                     ((cider-nrepl-op-supported-p "lookup") (cider-sync-request:lookup var))
                     (t (cider-fallback-eval:info var)))))
      (if all var-info (cider--var-choice var-info)))))

So the lookup fallback already was there.

@vemv vemv requested a review from bbatsov September 11, 2023 14:18
@vemv vemv merged commit f564181 into clojure-emacs:master Sep 11, 2023
@vemv vemv deleted the 3456 branch September 11, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jump-to-definition doesn't work in Babashka
2 participants