Subject: bug#65517: 30.0.50; Eglot: word list input

From: Gerd Möllmann <[email-masked]>
Date: Sat, 26 Aug 2023 06:55:54 +0200

João Távora <[email-masked]> writes:

> Gerd Möllmann <[email-masked]> writes:
>
>> THe prompt of C-M-. advertises that the user can enter a list of words
>> for search for, but that doesn't seem to be supported ATM.
>
> C-M-. is bound to the command 'xref-find-apropos'.  Eglot has installed
> a backend for this command.  
>
>    (cl-defmethod xref-backend-apropos ((_backend (eql eglot)) pattern)
>
> If you look into the implementation you'll see it uses the LSP
> 'workspace/symbol' request.  That interface is described in
>
>    https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol
>
> The sparsely described 'query' field doesn't seem to explicitly support
> 'multiple word' searches of 'multiple word fragment' searches out of the
> box.  Furthermore each LSP server implementation can more or less
> interpret this freely.  Some LSP server implementation might even
> support pattern-matching or even regexps there but it doesn't seem like
> 'clangd' (the server I presume you are using) does this.
>
> You can see the communication in the Eglot events buffer.  For example
> here's me trying to query for "ma loc" and getting no replies:
>
>    [client-request] (id:32) Fri Aug 25 09:48:56 2023:
>    (:jsonrpc "2.0" :id 32 :method "workspace/symbol" :params
>              (:query "ma loc"))
>    [stderr] I[09:48:56.386] <-- workspace/symbol(32)
>    [server-reply] (id:32) Fri Aug 25 09:48:56 2023:
>    (:id 32 :jsonrpc "2.0" :result [])
>
> If I query for 'malloc' instead, I get loads of hits.

Thanks for the technical explanation, I appreciate that.

I'm purely looking at things as a user, though: I see the prompt of
C-M-. mentions that I can enter a word list, and of course I'm trying
that out. I know or find out what word-list means, for instance because
the doc string of 'apropos' says

  PATTERN can be a word, a list of words (separated by spaces),
  or a regexp (using some regexp special characters).  If it is a word,
  search for matches for that word as a substring.  If it is a list of words,
  search for matches for any two (or more) of those words.

Now I'm simply wondering if what C-M-. does in this case fits that description.
Nothing more. I'm not saying anything should be implemented or whatever
else.  If you find the current state okay, that's fine with me.