GNU bug report logs - #73496
30.0.91; Eglot (and clangd) out of sync after switching git branches in magit

Previous Next

Package: emacs;

Reported by: Mikael Springer <mikael.springer <at> protonmail.com>

Date: Thu, 26 Sep 2024 09:46:02 UTC

Severity: normal

Found in version 30.0.91

Full log


Message #11 received at 73496 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 73496 <at> debbugs.gnu.org, Mikael Springer <mikael.springer <at> protonmail.com>
Subject: Re: bug#73496: 30.0.91; Eglot (and clangd) out of sync after
 switching git branches in magit
Date: Thu, 26 Sep 2024 11:25:04 +0100
On Thu, Sep 26, 2024 at 11:08 AM Eli Zaretskii <eliz <at> gnu.org> 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" <bug-gnu-emacs <at> gnu.org>
> >
> >
> > 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.




This bug report was last modified 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.