GNU bug report logs -
#73414
eglot: using auto-revert-mode and git checkout corrupts diagnostics
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello,
With auto-revert-mode and eglot enabled, using a git checkout to change
branch will leave invalid buffer diagnostics.
Emacs version: GNU Emacs 30.0.91
Operating system: Mac OS X
Eglot version: reproduced with emacs -Q on emacs30 pretest.
Server used: pyright
Steps to reproduce:
Using the following file:
```
def print_lorem_ipsum():
print("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
def print_lorem_ipsum_upper():
print("LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT.")
```
1. Initialize the git repository:
$ git init
$ git add a.py
$ git commit
$ git checkout -b test
# edit a.py and remove the function print_lorem_ipsum_upper
$ git add a.py
$ git commit
2. Start emacs on the test branch:
$ emacs -Q a.py
M-x auto-revert-mode
M-x eglot
3. Then go to the main branch:
$ git checkout main
After auto-revert-mode triggers a file reload, eglot will report that the
function print_lorem_ipsum_upper is duplicated. (See screenshot in
attachment)
See also the `eglot-events-buffer` logs in attachment.
In this state, even if you delete the function and rewrite it, the error
will stay.
The only way to fix the issue is to do a eglot-reconnect.
I can reproduce the issue on emacs30 with built-in eglot and I didn't have
the problem on emacs29 with eglot 1.15 from ELPA.
Thanks.
[Message part 2 (text/html, inline)]
[eglot_logs.txt (text/plain, attachment)]
[Screenshot 2024-09-21 at 14.30.02.png (image/png, attachment)]
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.