Open DavidVujic opened 3 years ago
Could you explain what dumb-jump-go
is better at in the examples you gave, that the xref iterface isn't?
Here's an example - xref doesn't seem to find ClojureScript re-agent
events or subscriptions. Here, I first use C-.
with no findings and then C-M-g
(dumb-jump-go) with a popup.
The behavior is slightly different when connected to a Cider
session or not. However, dumb-jump-go will in both cases present a search result. In both cases, xref doesn't find anything. I have verified this on a Linux machine running Emacs 25, and on a Mac running emacs 26. Maybe there is a configuration I should add for xref?
From what I see, xref doesn't seem to be using the dumb-jump backend (the miniprompt says "Visit tags table"), so it might be that xref-backend-functions
has just changed. What does M-: xref-backend-functions RET
say?
(defvar xref-backend-functions nil
"Special hook to find the xref backend for the current context.
Each function on this hook is called in turn with no arguments,
and should return either nil to mean that it is not applicable,
or an xref backend, which is a value to be used to dispatch the
generic functions.")
;; We make the etags backend the default for now, until something
;; better comes along. Use APPEND so that any `add-hook' calls made
;; before this package is loaded put new items before this one.
(add-hook 'xref-backend-functions #'etags--xref-backend t)
Oh! I realize I might have messed up my configuration. Accdentally put the
;; jump to definition
(dumb-jump-mode)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
after a provide
statement.
Sorry, I didn't mean the definition, that should be the same for everyone by default. I wanted to know what the buffer-local vaue was. The point is that if the value is (etags--xref-backend)
, then xref isn't using dumb-jump, but that can be changed, which should do everything that dumb-jump-go
does in your situation.
Alternativly, you could also use something like
(defun local/dumb-jump (arg)
(interactive (let ((xref-backend-functions '(dumb-jump-xref-activate)))
(list (xref--read-identifier "Find definitions of: "))))
(let ((xref-backend-functions '(dumb-jump-xref-activate)))
(xref-find-definitions arg)))
to test if the xref backend dumb-jump is properly working.
Thanks! I'll try that!
This is what is printed when I type "xref-backend-functions"
I tried with adding the local/dumb-jump
function to my config, but got this message. Maybe I misunderstood how to use it? (I'm an Emacs noob).
M-.
works fine (after I fixed the typo in my config) when browsing code. But when I activate Cider
the command is not finding anything (the same behaviour as the previous gif in this thread). Could it be that a different command is activated? I think I have read somewhere that the cider-find-var
is used - and the re-agent
events/subs aren't really vars.
Looks like it, but that doesn't explain the behaviour from the gif.
And the bug with "xref-backend-identifier-completion-table" was fixed in #374 mentioned here again.
FYI I've opened the issue at CIDER bug tracker asking not to rebing M-.
keybinding, and use xref backend feature instead: https://github.com/clojure-emacs/cider/issues/2987
Until then it seems that the only way to solve it for CIDER is to advice it's jumping functions to use xref, but the case with M-,
is a bit harder to advice as it seems
I very much like the new way of navigating with
M-.
and viaxref
. When inclojure-mode
thecider-find-var
command will be used, if I have understood it correctly.I think the now deprecated
dumb-jump-go
(C-M-g
) is still very useful:re-agent
, thecider-find-var
doesn't jump to events or subscriptions (I guess because of them not beingVars
). Butdumb-jump-go
does the job very good!Would it be a good idea to not deprecate that feature?