unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Alessandro Bertulli <alessandro.bertulli96@gmail.com>,
	help-gnu-emacs@gnu.org
Subject: Re: Xref/tags/lsp possible bug
Date: Mon, 25 Apr 2022 04:32:40 +0300	[thread overview]
Message-ID: <94193a02-b468-5d32-a746-5c84dd70c0a8@yandex.ru> (raw)
In-Reply-To: <CAJczNmAGo5B1bxf2JCaQJTi5fJ07BoBWobDOh8daLHaCWuofog@mail.gmail.com>

Hi!

On 23.04.2022 15:17, Alessandro Bertulli wrote:
> Hi all!
> 
> I just stumbled upon a very strange behavior of Emacs, I don't know if
> it is a bug or an error of my configuration. Basically, I noticed two
> things:
> 
> - First, when using LSP modes (both lsp-mode and eglot), the command
>    xref-find-definitions only acts on the symbol under point. I
>    explain: usually, in vanilla Emacs (emacs -q) if point is on a
>    whitespace/not on a symbol, invoking the command (bound to M-.) will
>    prompt you for an identifier to search for. However, when LSP is
>    active, it directly searches for an empty symbol, for example
>    reporting something similar to: "Symbol  not found" (not the double
>    space, which makes me think it searches for a symbol named ""). As I
>    said, this happend both for lsp-mode and eglot, so maybe is a
> problem of xref?

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).

> - Second, and minor: while I was investigating, I noticed that,
>    depending on the loaded packages, when giving M-., xref sometimes
>    asks for the symbol to search, sometimes it asks the TAGS table
> first. What package can be the problem?

ivy-mode, probably. Though it's not necessarily a "problem".

ivy-mode takes over the completing-read UI, and it tries to show the 
available completions right away. The identifier completion table 
provided by the default Xref backend uses tags, and when the table is 
not loaded, has to prompt for the file to load it from.



  parent reply	other threads:[~2022-04-25  1:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 12:17 Xref/tags/lsp possible bug Alessandro Bertulli
2022-04-23 12:52 ` Eli Zaretskii
2022-04-24 23:06   ` Dmitry Gutov
2022-04-25  1:32 ` Dmitry Gutov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-23 15:28 Alessandro Bertulli
2022-04-25 10:01 Alessandro Bertulli
2022-04-25 20:05 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-04-25 20:29   ` Dmitry Gutov
2022-04-25 21:48     ` Stefan Monnier
2022-04-26  1:41       ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94193a02-b468-5d32-a746-5c84dd70c0a8@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=alessandro.bertulli96@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).