Subject: Re: bug#73496: 30.0.91; Eglot (and clangd) out of sync after switching git branches in magit

From: Mikael Springer <[email-masked]>
Date: Thu, 24 Oct 2024 08:39:16 +0000

No, I'm sorry but I have not been able to spend time on this. I'm in the 
middle of moving so I will probably not have an opportunity to do this 
for quite some time. But I will get back to it as soon as I can.

Regards, Micke.

On 2024-10-19 08:58, Eli Zaretskii wrote:
>> Date: Thu, 26 Sep 2024 11:07:43 +0000
>> From: Mikael Springer <[email-masked]>
>> Cc: [email-masked]
>>
>> You are right, I have eglot-ensure enabled for c++ts-mode.
>>
>> I'll try to create an emacs -Q recipe for this as soon as I can. I also
>> agree and suspect that any outside file operation will work as a trigger.
> Ping!  Any success in creating such a recipe?
>
>> On 2024-09-26 12:25, João Távora wrote:
>>> On Thu, Sep 26, 2024 at 11:08 AM Eli Zaretskii <[email-masked]> wrote:
>>>>> Date: Thu, 26 Sep 2024 08:20:52 +0000
>>>>> From:  Mikael Springer via "Bug reports for GNU Emacs,
>>>>>    the Swiss army knife of text editors" <[email-masked]>
>>>>>
>>>>>
>>>>> 1. Visit buffer with C++ code -> Eglot starts.
>>>>> 2. Listing references for a variable in Eglot works.
>>>>> 3. Switch Git branch in magit.
>>>>> 4. Go back to C++ buffer. Listing references for a variable using Eglot
>>>>> does not work, error message in echo buffer; "jsonrpc-request:
>>>>> jsonrpc-error: "request id=44 failed:", (jsonrpc-error-code . -32602),
>>>>> (jsonrpc-error-message . "trying to get AST for non-added document"),
>>>>> (jsonrpc-error-data)"
>>>>> 5. Closing the buffer and opening it again fixes the problem, or doing
>>>>> eglot-reconnect also fixes the problem, listing references is working
>>>>> again.
>>>>> 6. This is true for all open C++ buffers handled by Eglot before the
>>>>> branch switch.
>>>> CC'ing João.
>>> It would be great if Mikael could make this into a Emacs -Q recipe
>>> to ease investigation and rule out interference from configuration etc.
>>>
>>> For example this isn't  true
>>>
>>>     Visit buffer with C++ code -> Eglot starts.
>>>
>>> unless you use eglot-ensure in your config.  And possibly Magit isn't
>>> needed to trigger this, a simple Git branch change on the side will do (or
>>> maybe it won't in which case Magit has to be investigated, too).
>>>
>>> A concrete example toy repo with, say, a single file would also
>>> be useful.
>>>
>>> João.
>>