unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: "João Távora" <joaotavora@gmail.com>
Cc: 73355@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#73355: 29.4; eglot-rename reports success when it shouldn't
Date: Sun, 22 Sep 2024 00:46:04 +0200	[thread overview]
Message-ID: <8634lspqvn.fsf@fastmail.fm> (raw)
In-Reply-To: <CALDnm5056c37LGNSUN5CAYLGrz5bEcJhPMegQOaJetmiRPOKpQ@mail.gmail.com> ("João Távora"'s message of "Sat, 21 Sep 2024 12:43:32 +0100")

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





  parent reply	other threads:[~2024-09-21 22:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19 12:01 bug#73355: 29.4; eglot-rename reports success when it shouldn't Joost Kremers
2024-09-19 16:07 ` Joost Kremers
2024-09-21 10:34 ` Eli Zaretskii
2024-09-21 11:43   ` João Távora
2024-09-21 12:12     ` Joost Kremers
2024-09-21 20:15       ` João Távora
2024-09-21 22:04         ` Joost Kremers
2024-09-21 22:31           ` João Távora
2024-09-21 22:46     ` Joost Kremers [this message]
2024-10-05  9:57       ` Eli Zaretskii
2024-10-19  7:03         ` Eli Zaretskii
2024-11-02 11:43           ` Eli Zaretskii
2024-11-02 13:26             ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8634lspqvn.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=73355@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).