Subject: bug#61506: 30.0.50; [PATCH]: Send command in eglot completion exit-function

From: Theodor Thornhill <[email-masked]>
Date: Wed, 15 Feb 2023 13:34:32 +0100

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

> Theodor Thornhill <[email-masked]> writes:
>
>>>Can you list some servers that send this info?  And if it is not too
>>>much trouble can write a simple recipe where supporting this feature
>>>actually makes a difference?  Thanks.
>>
>> As for proving a difference, not sure how easy that is. The code
>> around the link I posted seems to score, so I guess over time the
>> server should learn _something_. It's a little hard to verify anyway
>> because eglot doesn't respect the ordering provided by the server
>> (which is a different bug in itself).
>
> I don't understand what you mean.  There is this code in
> eglot-completion-at-point:
>  
>  ...
>  (sort-completions
>   (lambda (completions)
>     (cl-sort completions
>              #'string-lessp
>              :key (lambda (c)
>                     (or (plist-get
>                          (get-text-property 0 'eglot--lsp-item c)
>                          :sortText)
>                         "")))))
>  ...
>
> Is it not working?  I see sensible orderings in the servers I use.  Is
> there a reported bug about this?  If there isn't, please make one.
>

It seems something happens with yasnippets.  I only have the symptoms
yet, but I'll make a report when I know what's happening :)

>> Anyway, lsp-mode, neovim and others support this, so I see no reason
>> we shouldn't :)
>
> FWIW I don't see this as a good enough reason in itself.  If there is
> little to no discernible benefit, supporting esoteric features can
> become code bloat that makes maintenance of more important features
> difficult.  There is a fair amount of junk in the LSP standard, or
> simply stuff that doesn't make as much sense in Emacs as it does in
> other editors.
>

Yeah, I agree.  However, this should make sense in Emacs too, no?

> Regardless, I'm not opposed to this feature if there's a simple enough
> patch.  But we should weigh pros and cons -- and Felicián's request to
> measure the pros is quite reasonable.

The patch is simple enough, it could just be its own function, to be
executed.  Then it's a one-liner in the exit-function

>
> (Not to mention that a smart enough server can already derive these
> smarts from the evolution of the LSP document's contents as reported by
> the client.)
>

Maybe - I don't think that's reason enough to dismiss the command
argument outright, though.

> João

Theo