Fork me on GitHub
#cider
<
2022-07-02
>
lispers-anonymous14:07:44

When I use cider and eglot, cider's implementation of xref-find-references is used, but I would prefer to use eglot's xref implementation. Is there a way for me to tell emacs to use eglot instead of cider? Or a maybe a way to disable cider's xref implementation completely?

apt14:07:22

I’m not sure how to configure this, but just one warning. eglot does not handle definitions of external projects (as of today), while cider does. https://github.com/joaotavora/eglot/issues/661

apt14:07:33

That said, I use eglot and live with that. For external definitions, I use clojure.repl/source or clojure.repl/doc or even open the source code, since it’s usually a lib from my own company.

apt14:07:59

Also, maybe there’s a way of assigning higher priority to eglot’s backend, supposing it’s hooked into xref. I’m not too familiar with xref so I don’t know if it’s possible.

lispers-anonymous14:07:09

I am aware, but cider's xref-find-references only leads me to the top level form, usually a function, that references something. Clojure-lsp and eglot take me directly to the reference. For external projects, I just use cider-find-var .

lispers-anonymous14:07:51

A solution I just came to after reading some cider source was to redefine this function after cider is loaded

(defun cider--xref-backend () nil)

👍 1
lispers-anonymous14:07:39

When it always returns nil cider doesn't set any xref stuff, but the other commands cider provides for navigation continue to work. Feels like a hack but I like it better than what I had before.

apt15:07:31

Great. That looks easier, indeed.

💯 1
lispers-anonymous17:07:52

Wow I feel so dumb. All that searching and I somehow didn't find that. It's exactly what I'm looking for. The xref-fn-depth specifically. Thank you for sending that to me!