GNU bug report logs - #73355
29.4; eglot-rename reports success when it shouldn't

Previous Next

Package: emacs;

Reported by: Joost Kremers <joostkremers <at> fastmail.fm>

Date: Thu, 19 Sep 2024 12:02:02 UTC

Severity: normal

Merged with 73358

Found in version 29.4

Full log


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

From: Joost Kremers <joostkremers <at> fastmail.fm>
To: João Távora <joaotavora <at> gmail.com>
Cc: 73355 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#73355: 29.4; eglot-rename reports success when it shouldn't
Date: Sun, 22 Sep 2024 00:46:04 +0200
On Sat, Sep 21 2024, João Távora wrote:
> I have this some version of this server somewhere, maybe I can reproduce,
> but as always better to follow the instructions in the manual
> https://joaotavora.github.io/eglot/#Troubleshooting-Eglot and give the
> remaining items of a full MRE.

OK, here goes:

1. The relevant lines from the events buffer (apologies for the long lines):

```
[jsonrpc] e[00:13:52.047] --> textDocument/rename[27] {"jsonrpc":"2.0","id":27,"method":"textDocument/rename","params":{"textDocument":{"uri":"file:///home/joost/Projects/Python/pyscratch/src/search.py"},"position":{"line":88,"character":29},"newName":"seq"}}
[jsonrpc] e[00:13:52.049]   <-- textDocument/rename[27] #[0 "\300\301\302\303\304\305\257\6\207" [:id 27 :jsonrpc "2.0" :result nil] 14]
```

Contrast this with a call to 'eglot-rename' that *does* yield changes:

```
[jsonrpc] e[00:16:34.228] --> textDocument/rename[68] {"jsonrpc":"2.0","id":68,"method":"textDocument/rename","params":{"textDocument":{"uri":"file:///home/joost/Projects/Python/pyscratch/src/search.py"},"position":{"line":87,"character":8},"newName":"arr"}}
[jsonrpc] e[00:16:34.235]   <-- textDocument/rename[68] #[0 "\323\312\324\325\326\327\313\330\313\302\303\304\305\306\307\300\331\301\314F\310\300\332\301\314FF\257\6\302\303\304\305\306\307\300\333\301\315F\310\300\334\301\315FF\257\6\302\303\304\305\306\307\300\311\301\316F\310\300\312\301\316FF\257\6\302\303\304\305\306\307\300\317\301\320F\310\300\311\301\320FF\257\6\302\303\304\305\306\307\300\317\301\321F\310\300\311\301\321FF\257\6\302\303\304\305\306\307\300\335\301\322F\310\300\336\301\322FF\257\6&\6\337\340\341\342\343FF!D\257\6\207" [:character :line :annotationId "default" :newText "arr" :range :end :start 71 68 vector 87 88 89 74 90 91 93 :id :jsonrpc "2.0" :result :documentChanges :edits 11 8 32 29 50 47 :textDocument :uri "file:///home/joost/Projects/Python/pyscratch/src/search.py" :version nil] 34]
```

Looks like basedpyright is reporting that it didn't make any changes in the
first case (':results nil').

2. Emacs did not signal an error.

3. The language server I used is basedpyright, which can be installed from
PyPI with the usual tools. I have version 1.17.5, which is the latest
release.

To configure Eglot to use it, the basedpyright docs suggest to add the
following to one's init file (which is what I do):

```
(add-to-list 'eglot-server-programs
             '((python-mode python-ts-mode)
               "basedpyright-langserver" "--stdio"))
```

See https://docs.basedpyright.com/#/installation for details.

4. For a minimal project, all you'll need is a single Python file with a
single function, which can be as simple as this:

```
def some_func():
    a: int = 5
    b: int = d + 7
    c: int = d + 13
    print(b+c)
```

Try to rename the two occurrences of 'd' to 'a'.

The code snippet in my original email will also do, even if basedpyright
will report a bunch of errors in it for undefined functions. Those don't
affect the rename.

5. Emacs: 29.4, Eglot 1.17 (from GNU ELPA), basedpyright 1.17.5.

6. I assume the issue is so straightforward that there's no need for a
recipe that's more detailed than the above.

Thanks,

Joost


-- 
Joost Kremers
Life has its moments




This bug report was last modified 225 days ago.

Previous Next


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