From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.bugs Subject: bug#73355: 29.4; eglot-rename reports success when it shouldn't Date: Sun, 22 Sep 2024 00:46:04 +0200 Message-ID: <8634lspqvn.fsf@fastmail.fm> References: <86plozvomz.fsf@fastmail.fm> <864j6947n1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27891"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73355@debbugs.gnu.org, Eli Zaretskii To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 22 00:47:08 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ss8sc-00075q-N4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Sep 2024 00:47:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ss8sF-0002PG-GF; Sat, 21 Sep 2024 18:46:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss8sD-0002P3-Nd for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 18:46:42 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ss8sD-0007nQ-Eh for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 18:46:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Qc6d3t0rNoxAlJILYgsEQe+KazBhBPWaRImYGbsN+J8=; b=qA6DAZ3gPCMQPGtV0huAysXdnxVX2CVuvHLK6s0Aeb1LOBaWcZK5s15zQipOFAOrW3FTDVqKyra6mWy35lhmelSHT0gAgJHdX/FKEeEM2jJDVOEJygpiHSRxZOq+ofURJ+1JLq7jE6eohhfJGl8IhC2DmRlc1wd3UaM3ZxqgkUBnupzNi7yABhA9ipB/WKNQfxICi2sV2lUEp9IXaNcQ1Q+ScZUdQB0bD/FjfDC/jI32kgm0TYHapm1I5ztIrTyfay8gE7AwGnvFNrFNzDiNSqtvu22QtxGjPYJIUMxIOWexTaW7rUSdHxhmyA4ozp2Q2h35vym2s7VZdNe+Q/fV5g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ss8sX-00054X-Qy for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 18:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joost Kremers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Sep 2024 22:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73355 X-GNU-PR-Package: emacs Original-Received: via spool by 73355-submit@debbugs.gnu.org id=B73355.172695879619441 (code B ref 73355); Sat, 21 Sep 2024 22:47:01 +0000 Original-Received: (at 73355) by debbugs.gnu.org; 21 Sep 2024 22:46:36 +0000 Original-Received: from localhost ([127.0.0.1]:40435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss8s7-00053T-Qm for submit@debbugs.gnu.org; Sat, 21 Sep 2024 18:46:36 -0400 Original-Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]:46291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss8s6-00053D-Kd for 73355@debbugs.gnu.org; Sat, 21 Sep 2024 18:46:35 -0400 Original-Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3C1B31140430; Sat, 21 Sep 2024 18:46:08 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Sat, 21 Sep 2024 18:46:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1726958768; x=1727045168; bh=Qc6d3t0rNoxAlJILYgsEQe+KazBhBPWaRImYGbsN+J8=; b= Lz2GHUnTJXc4UNr2237EwtYeDaJv7wEpDPNWP1iGy6U8YjU60mTCvekEKsPKjWtN 4k1womsy7Z/nXxJGMkc70d2xa4H4QcrY8bW339GE75Ky6XjP/jWeduwNqg1vtQRL MBq4D5BUZk0Qm864yc69N+jdGY+f0MrRHtTpUR50vdVc6Vp3DNee6hB1sRnA1XWz yvV9HDrL6/8GmM2Hpd0kS0wLS65uIweLguO36AhSjrFOyt8ZFr4YYy+bRnVvyWkO bgGy8lmP8/HQVNmtf1a/jGZHzvJXFSqgLzcp8BO3xVSmNNhIx7sePS18H6OvRoF9 cfMgXDyADeSzWJ+8N63+KQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1726958768; x= 1727045168; bh=Qc6d3t0rNoxAlJILYgsEQe+KazBhBPWaRImYGbsN+J8=; b=Z GgkYwXy4lamIf1rMTuWd/VmOFGP5oyJGzDmphk1aEe8HDGA1hEBCV5L41og6KEy5 C3iP5DwoencMw4dlrozfMz16r1G8kp8TTXlll8kIt5Ecl4dQwt0UmYINN0RN2aSK MTBRpuu/gOlAEhUjlScol5xXIwm3BsACqUo0VHAj9fNUpgr7lzDLYrUW0gg0yaNR 2hl8QFW0d1OaUKgb6bUh4xUCSxJybMgeKgEpzHMA5KhCkbktPso9JDW/MiCvCSV/ Yp8eOSkjeLUtX/KBzLrtPtBfk28BdemJr7Oa+9cx7d0RQTvGMgs3DZwNbQ/w8jTM p3ndu0ogJ3zHs0v2l0lJg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeliedgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegoufhushhpvggtthffohhmrghinhculdegledmnecujfgurhep hffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheplfhoohhsthcumfhrvg hmvghrshcuoehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmheqnecuggft rfgrthhtvghrnheptedugefgveeihedtleelgffgtdeljeekvdeuleegieeljedukeeutd ehveetteeknecuffhomhgrihhnpehgihhthhhusgdrihhopdgsrghsvgguphihrhhighhh thdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepjeeffeehheesuggvsggsuh hgshdrghhnuhdrohhrghdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphht thhopehjohgrohhtrg X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 21 Sep 2024 18:46:06 -0400 (EDT) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sat, 21 Sep 2024 12:43:32 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292212 Archived-At: On Sat, Sep 21 2024, Jo=C3=A3o T=C3=A1vora 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\3= 03\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\3= 25\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\3= 15FF\257\6\302\303\304\305\306\307\300\311\301\316F\310\300\312\301\316FF\2= 57\6\302\303\304\305\306\307\300\317\301\320F\310\300\311\301\320FF\257\6\3= 02\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\34= 1\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 "fi= le:///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 =3D 5 b: int =3D d + 7 c: int =3D 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 --=20 Joost Kremers Life has its moments