bug#81624: New command: xref-find-by-kind

João Távora <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Dmitry Gutov <[email protected]> writes:

> X-Debbugs-Cc: [email protected], [email protected]
> See the branch 'xref-find-by-kind', feedback welcome!

I've skimmed the diff (on my mobile) and my overall feedback is positive.

One thing I'd like to see address: what to do about

   (defun eglot-find-declaration...
   (defun eglot-find-implementation...
   (defun eglot-find-typeDefinition...

?

I'd like to see them rewritten using new xref.el entry points, but
xref-backend-xrefs-by-kind is just a "get information" entry point
(which is fine).

IIRC I suggested a 'xref-define-finder' macro

   (defmacro xref-define-finder (command kind) ...)

And then that trio of definitions could become

   (xref-define-finder eglot-find-declaration declaration)
   (xref-define-finder eglot-find-implementation implementation)
   (xref-define-finder eglot-find-typeDefinition type-definition)

And go almost exclusively through the same xref code paths as the other
non-eglot-specific entry points and I we could bin that hacky
eglot--lsp-xref-helper, offsetting some of the new complexity addition.

On a less important note

>    * lisp/progmodes/xref.el (xref-find-by-kind): Delete " of" from
>    the identifier prompt.  I've gone back and forth on this - it
>    reads a bit better with Eglot (LSP kinds) but does not fit the
>    Elisp backend.

Heh, if you really wanted to go heroic/ocd you could make new optional
:format key entry in the kind

   (:kind declaration :name "declaration" :key ?d :prompt-format "Find %s of")

Not sure it's worth it, but not very hard to do either, I suppose.

João
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.