Subject: Re: bug#67870: 29.1; Eglot missing or un-findable advertised feature

From: Dave Abrahams <[email-masked]>
Date: Mon, 18 Dec 2023 11:10:19 -0800

Of course it's easy for *you* to find; you know what you're looking for.  I wouldn't have filed a bug if I wasn't having trouble, and I figured the experience of someone not familiar with the package might count for soimething. I looked for the words "suggested" and "fixes" and couldn't find anything.  I googled.   I looked at flymake docs too because given the phrasing I thought it might have been there.  If you'd used some of the distinctive words that could be found in the eglot manual around these commands (e.g. quickfix, action, rewrite), I wouldn't have had any trouble.  "fix" by itself is a bit too short and common to be a good search keyword.

> On Dec 18, 2023, at 9:00 AM, João Távora <[email-masked]> wrote:
> 
> On Sun, Dec 17, 2023 at 7:40 PM Dave Abrahams <[email-masked]> wrote:
> 
>> The info page for Eglot says:
>> 
>> 3.1 Eglot features:
>> 
>>   • On-the-fly diagnostic annotations with server-suggested fixes, via
>>     the Flymake package (*note (flymake)Top::).
>> 
>> But I can find no evidence of the support for server-suggested fixes
>> either in flymake or in eglot itself.  I am working with an LSP server
>> that offers fix-its but can't find any way to apply them.
> 
> Isn't very hard to find in "3.3 Eglot commands" IMO
> 
> ‘M-x eglot-code-actions’
> ‘M-x eglot-code-action-organize-imports’
> ‘M-x eglot-code-action-quickfix’
> ‘M-x eglot-code-action-extract’
> ‘M-x eglot-code-action-inline’
> ‘M-x eglot-code-action-rewrite’
>     These commands allow you to invoke the so-called “code actions”:
>     requests for the language server to provide editing commands for
>     correcting, refactoring or beautifying your code.  These commands
>     may affect more than one visited file belonging to the project.
> 
>     The command ‘eglot-code-actions’ asks the server if there [are] any code
>     actions for any point in the buffer or contained in the active
>     region.  If there are, you have the choice to execute one of them
>     via the minibuffer.
> 
>     A common use of code actions is fixing the Flymake error
>     diagnostics issued by Eglot (*note (flymake)Top::).  Clicking on a
>     diagnostic with ‘mouse-2’ invokes ‘eglot-code-actions-at-mouse’
>     which pops up a menu of available code actions.  The variable
>     ‘eglot-diagnostics-map’ can be used to control the mouse binding.
> 
>     Other commands execute a specific code action.  For example,
>     ‘eglot-code-action-organize-imports’ rearranges the program's
>     “imports”--declarations of modules whose capabilities the program
>     uses.
> 
>> Either what's meant by this should be clarified, leading to discoverable
>> instructions for exploiting the feature, or the text should be removed.
> 
> That's just a summarized list of the main features, a detailed description
> doesn't of how to use the feature doesn't belong there.  But patches welcome for
> a link down to 3.3 (and fixing the typo while you're at it).
> 
> João