help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xref/tags/lsp possible bug


From: Alessandro Bertulli
Subject: Re: Xref/tags/lsp possible bug
Date: Mon, 25 Apr 2022 12:01:56 +0200

Thanks Dmitry!

> AFAIK it's a limitation of the LSP protocol: it's unable to perform
> completion on all symbol names globally. Nor is it able, in general, to
> find a symbol by name (it needs a location of an existing reference in
> some file). So that affects how lsp-mode's Xref integration works (and
> Eglot's).

Indeed, you're right, I opened an issue on lsp-mode's GitHub and the
maintainer (Ivan) kindly answered me. I report here its answer, in case
it is useful to someone:

"In lsp protocol, there is no convenient method to list the symbols.
We do some hacks using document symbols to provide some handling when
the method is invoked like that C-u M-x xref-find-definitions(or with
(setq xref-prompt-for-identifier t)) but that is not really what the
xref wants. This feature of xref is designed with tags in mind and it
does not fit well with lsp protocol. Thus we have created lsp-find-*
set of functions to make the difference between lsp and xref more
evident."

Okay, it's not a real problem, but I wonder why is it, though. I
suppose LSP does have a sort of symbol table kept in memory, so I
think it wouldn't be a big problem to allow the user to query it. I
suppose it's something that can be added in a future specification.

As a side note, reading your answer to Eli: yes, I got the hint it
could be a problem of Xref, that's a part of why I asked here (being
Xref a part of Emacs, or at least GNU Elpa).

Anyway, thank you all for your support!

Alessandro


reply via email to

[Prev in Thread] Current Thread [Next in Thread]