unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73355: 29.4; eglot-rename reports success when it shouldn't
@ 2024-09-19 12:01 Joost Kremers
  2024-09-19 16:07 ` Joost Kremers
  2024-09-21 10:34 ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Joost Kremers @ 2024-09-19 12:01 UTC (permalink / raw)
  To: 73355


I tried to use 'eglot-rename' to rename a variable to a name that already
existed in the relevant function. The change was not applied but Eglot
nonetheless reported "[eglot] Edit successful!".

This was in a Python buffer, using python-ts-mode and basedpyright
(v1.17.1) as language server. The relevant code snippet:

```
def main():
    sizes = [100, 1000, 10000]
    results: dict[str, list[float]] = {
        "Linear search": [],
        "Binary search": [],
        "Interpolation search": [],
    }
    for size in sizes:
        seq: list[int] = sorted([random.randint(0, 10000) for _ in range(size)])
        x = random.choice(arr)
        results["Linear search"].append(measure_time(linear_search, arr, x))
        results["Binary search"].append(measure_time(binary_search, arr, x))
        results["Interpolation search"].append(
            measure_time(interpolation_search, arr, x)
        )
```

Note the 'seq' variable in the first line of the for loop, and the 'arr'
variable in the three '.append' invocations. With point on the first 'arr',
calling eglot-rename and giving 'seq' as the new name, Eglot refuses to
rename the three occurrences of 'arr' (which makes sense, given that a
variable with that name obviously already exists), but still reports
success.

(Note that there is no problem if the 'seq' above is also 'arr'. Then
renaming works fine.)



In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.0)
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --with-native-compilation=aot --sysconfdir=/etc
 --prefix=/usr --libexecdir=/usr/lib --with-tree-sitter
 --localstatedir=/var --with-cairo --disable-build-details --with-harfbuzz
 --with-libsystemd --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2
 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat
 -Werror=format-security -fstack-clash-protection -fcf-protection
 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
 -Wl,-z,pack-relative-relocs -flto=auto' 'CXXFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3
 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection
 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 -Wp,-D_GLIBCXX_ASSERTIONS -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: VTerm

Minor modes in effect:
  magit-auto-revert-mode: t
  pyvenv-mode: t
  mu4e-modeline-mode: t
  consult-denote-mode: t
  flycheck-indicator-mode: t
  global-flycheck-eglot-mode: t
  minions-mode: t
  doom-modeline-mode: t
  which-key-mode: t
  global-atomic-chrome-edit-mode: t
  marginalia-mode: t
  all-the-icons-completion-mode: t
  company-prescient-mode: t
  prescient-persist-mode: t
  vertico-multiform-mode: t
  eros-mode: t
  hexl-follow-ascii: t
  eglot-booster-mode: t
  vertico-mode: t
  global-diff-hl-mode: t
  global-git-commit-mode: t
  global-treesit-auto-mode: t
  which-function-mode: t
  global-org-modern-mode: t
  denote-menu-bar-mode: t
  shell-dirtrack-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  global-company-mode: t
  company-mode: t
  csv-field-index-mode: t
  override-global-mode: t
  server-mode: t
  repeat-mode: t
  winner-mode: t
  electric-pair-mode: t
  recentf-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  auto-save-visited-mode: t

Load-path shadows:
~/src/parsebib/parsebib hides /home/joost/.emacs.d/elpa/parsebib-20230228.1530/parsebib
~/.emacs.d/lisp/custom hides /usr/share/emacs/29.4/lisp/custom
/home/joost/.emacs.d/elpa/transient-20240918.1138/transient hides /usr/share/emacs/29.4/lisp/transient
/home/joost/.emacs.d/elpa/jsonrpc-1.0.25/jsonrpc hides /usr/share/emacs/29.4/lisp/jsonrpc
/home/joost/.emacs.d/elpa/eglot-1.17/eglot hides /usr/share/emacs/29.4/lisp/progmodes/eglot
/home/joost/.emacs.d/elpa/eldoc-1.15.0/eldoc hides /usr/share/emacs/29.4/lisp/emacs-lisp/eldoc

Features:
(shadow emacsbug goto-addr magit-extras apheleia apheleia-rcs apheleia-dp
apheleia-formatters apheleia-utils apheleia-log apheleia-formatter-context
view vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs bug-reference pandoc-mode
pandoc-mode-utils markdown-mode magit-bookmark magit-submodule magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files
magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode magit-core magit-autorevert magit-margin
magit-transient magit-process epa-file network-stream mailalias
vertico-buffer misearch multi-isearch kivy-mode combobulate
combobulate-json combobulate-yaml combobulate-css combobulate-js-ts
combobulate-python combobulate-html combobulate-query savehist scheme
combobulate-ui combobulate-display combobulate-ztree combobulate-contrib
multiple-cursors mc-separate-operations rectangular-region-mode mc-mark-pop
mc-edit-lines mc-hide-unmatched-lines-mode mc-mark-more sgml-mode facemenu
mc-cycle-cursors multiple-cursors-core rect combobulate-envelope
combobulate-manipulation combobulate-procedure combobulate-navigation
combobulate-misc combobulate-interface combobulate-rules
combobulate-settings indent-bars-ts indent-bars cap-words superword subword
pyvenv smiley gnus-cite mm-archive mail-extr qp textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check
display-line-numbers mu4e-settings gnus-dired mu4e mu4e-org
mu4e-notification mu4e-main smtpmail mu4e-view mu4e-mime-parts mu4e-headers
mu4e-thread mu4e-actions mu4e-compose mu4e-draft gnus-msg mu4e-search
mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message flow-fill mu4e-contacts
mu4e-update mu4e-folders mu4e-context mu4e-query-items mu4e-server
mu4e-modeline mu4e-vars mu4e-helpers mu4e-config mu4e-window mu4e-obsolete
emoji-labels emoji multisession sqlite ace-window help-fns radix-tree
descr-text avy corg guess-language visual-fill-column org-autolist
org-indent oc-basic mule-util vc-git consult-flycheck consult-denote
consult display-fill-column-indicator flyspell ispell flycheck-indicator
flycheck-ledger flycheck-eglot flycheck-posframe flycheck eldoc-box
jk-input-methods quail solarized-light-theme solarized-theme solarized
solarized-faces go-translate gt-text-utility gt-engine-echo gt-engine-libre
gt-engine-chatgpt gt-engine-youdao gt-engine-stardict gt-engine-deepl
gt-engine-google-rpc gt-engine-google gt-engine-bing gt-extension gt-faces
gt-core gt-httpx wgrep-ag wgrep csv2ledger vterm bookmark term disp-table
ehelp vterm-module term/xterm xterm ielm minions doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f
nerd-icons nerd-icons-faces nerd-icons-data nerd-icons-data-mdicon
nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon
nerd-icons-data-sucicon nerd-icons-data-wicon nerd-icons-data-faicon
nerd-icons-data-powerline nerd-icons-data-octicon nerd-icons-data-pomicon
nerd-icons-data-ipsicon which-key atomic-chrome iimage image+ image-file
image-converter marginalia all-the-icons-completion company-prescient
prescient char-fold orderless vertico-multiform dockerfile-mode sh-script
smie executable impatient-mode htmlize jupyter python-pytest edebug eros
macrostep checkdoc paredit dape hexl gdb-mi gud eglot-booster eglot
external-completion jsonrpc flymake-proc flymake diff ert debug backtrace
org-linenote vertico projectile lisp-mnt grep ibuf-ext ibuffer
ibuffer-loaddefs ag vc-svn compile find-dired s diff-hl log-view vc-dir
ewoc vc vc-dispatcher diff-mode git-commit with-editor log-edit pcvs-util
add-log magit-mode benchmark magit-git magit-base magit-section
cursor-sensor crm autorevert aggressive-indent nswbuff finder-inf yaml-mode
yaml treesit-auto reftex reftex-loaddefs reftex-vars which-func imenu
tab-jump-out yasnippet-snippets yasnippet company-org-block org-modern
org-settings org-clock ob-jupyter jupyter-tramp tramp-cache time-stamp
jupyter-server jupyter-server-kernel jupyter-rest-api url-http url-auth
url-gw nsm jupyter-org-extensions jupyter-org-client jupyter-repl
jupyter-widget-client websocket bindat simple-httpd jupyter-client
jupyter-kernel jupyter-monads jupyter-messages hmac-def jupyter-mime
jupyter-kernelspec jupyter-env jupyter-base eieio-base ob-sqlite ob-sql
ob-shell ob-clojure ob-python python treesit ol-w3m org-tempo tempo
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message sendmail yank-media rfc822 mml mml-sec epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win ol-eww eww
thingatpt shr pixel-fill kinsoku svg puny mm-url gnus nnheader gnus-util
text-property-search mail-utils range mm-util mail-prsvr ol-doi
org-link-doi ol-docview doc-view filenotify jka-compr image-mode exif
ol-bibtex ol-bbdb org-element org-persist xdg org-id org-refile avl-tree
dom org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete org-list org-footnote org-faces org-entities
noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
cal-loaddefs org-version org-compat org-macs transient compat compat-30
denote dired dired-loaddefs tramp tramp-loaddefs trampver tramp-integration
tramp-compat shell pcomplete comint ansi-osc parse-time format-spec
ansi-color mixed-pitch face-remap biblio biblio-download biblio-dissemin
biblio-ieee biblio-hal biblio-dblp biblio-crossref biblio-arxiv timezone
biblio-doi biblio-core let-alist url-queue url-file ido hl-line bibtex
iso8601 time-date adaptive-wrap goggles comp comp-cstr warnings rx pulse
color posframe hydra lv use-package-bind-key company-quickhelp pos-tip
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons company-keywords
company-etags etags fileloop xref project company-gtags
company-dabbrev-code company-dabbrev company-ipa company-files
company-clang company-cmake company-semantic company-template company-css
company-capf company use-package-ensure whitespace literate-scratch
jk-functions advice csv-mode sort dash eshell esh-cmd generator esh-ext
esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util files-x
notifications dbus xml use-package-core cl-extra help-mode edmacro kmacro
bind-key server repeat winner ring elec-pair recentf tree-widget delsel
help-at-pt cus-edit pp cus-load icons wid-edit
all-the-icons-completion-autoloads all-the-icons-autoloads
apheleia-autoloads easy-mmode async-autoloads avy-autoloads
boxquote-autoloads breadcrumb-autoloads citar-autoloads citeproc-autoloads
clojure-mode-autoloads company-auctex-autoloads auctex-autoloads tex-site
company-box-autoloads company-prescient-autoloads
company-quickhelp-autoloads consult-denote-autoloads
consult-flycheck-autoloads corg-autoloads csv-mode-autoloads dape-autoloads
denote-autoloads devdocs-browser-autoloads diff-hl-autoloads
docker-autoloads dockerfile-mode-autoloads doom-modeline-autoloads
eglot-booster-autoloads eldoc-box-autoloads embark-consult-autoloads
consult-autoloads embark-autoloads eros-autoloads expand-region-autoloads
flycheck-clj-kondo-autoloads flycheck-eglot-autoloads eglot-autoloads
eldoc-autoloads go-translate-autoloads goggles-autoloads gptel-autoloads
guess-language-autoloads hydra-autoloads ialign-autoloads
impatient-mode-autoloads htmlize-autoloads indent-bars-autoloads
company-autoloads js2-mode-autoloads json-process-client-autoloads
jsonian-autoloads jsonrpc-autoloads jupyter-autoloads kivy-mode-autoloads
ledger-mode-autoloads literate-scratch-autoloads lv-autoloads
macrostep-autoloads magit-autoloads magit-section-autoloads
marginalia-autoloads markdown-mode-autoloads minions-autoloads
multiple-cursors-autoloads nerd-icons-autoloads numpydoc-autoloads
nushell-ts-mode-autoloads orderless-autoloads org-linenote-autoloads
org-modern-autoloads paredit-autoloads parsebib-autoloads
pdf-tools-autoloads pos-tip-autoloads posframe-autoloads
prescient-autoloads projectile-autoloads python-pytest-autoloads
realgud-autoloads realgud-recursive-autoloads loc-changes-autoloads
load-relative-autoloads f-autoloads simple-httpd-autoloads
sly-overlay-autoloads sly-autoloads solarized-theme-autoloads
string-inflection-autoloads tab-jump-out-autoloads tablist-autoloads
test-simple-autoloads tide-autoloads flycheck-autoloads dash-autoloads
track-changes-autoloads transient-autoloads treesit-auto-autoloads
vertico-autoloads vterm-autoloads vundo-autoloads web-mode-autoloads
websocket-autoloads which-key-autoloads with-editor-autoloads info
compat-autoloads yaml-autoloads yaml-mode-autoloads
yasnippet-snippets-autoloads yasnippet-autoloads zmq-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
pcase rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win
term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar
mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese
eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule custom
widget keymap hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1406460 189413)
 (symbols 48 81849 6)
 (strings 32 459186 19206)
 (string-bytes 1 12806777)
 (vectors 16 178171)
 (vector-slots 8 4425380 245877)
 (floats 8 2187 1021)
 (intervals 56 19925 5482)
 (buffers 984 49))

-- 
Joost Kremers
Life has its moments





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  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
  1 sibling, 0 replies; 13+ messages in thread
From: Joost Kremers @ 2024-09-19 16:07 UTC (permalink / raw)
  To: 73355

Apologies for the double posting. My mail client behaved weird when I sent
the first message and I didn't get a confirmation, which normally comes
within a few minutes, so I thought something had gone wrong...

On Thu, Sep 19 2024, Joost Kremers wrote:
> I tried to use 'eglot-rename' to rename a variable to a name that already
> existed in the relevant function. The change was not applied but Eglot
> nonetheless reported "[eglot] Edit successful!".
>
> This was in a Python buffer, using python-ts-mode and basedpyright
> (v1.17.1) as language server. The relevant code snippet:
>
> ```
> def main():
>     sizes = [100, 1000, 10000]
>     results: dict[str, list[float]] = {
>         "Linear search": [],
>         "Binary search": [],
>         "Interpolation search": [],
>     }
>     for size in sizes:
>         seq: list[int] = sorted([random.randint(0, 10000) for _ in range(size)])
>         x = random.choice(arr)
>         results["Linear search"].append(measure_time(linear_search, arr, x))
>         results["Binary search"].append(measure_time(binary_search, arr, x))
>         results["Interpolation search"].append(
>             measure_time(interpolation_search, arr, x)
>         )
> ```
>
> Note the 'seq' variable in the first line of the for loop, and the 'arr'
> variable in the three '.append' invocations. With point on the first 'arr',
> calling eglot-rename and giving 'seq' as the new name, Eglot refuses to
> rename the three occurrences of 'arr' (which makes sense, given that a
> variable with that name obviously already exists), but still reports
> success.
>
> (Note that there is no problem if the 'seq' above is also 'arr'. Then
> renaming works fine.)
>
>
>
> In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
> cairo version 1.18.0)
> System Description: Arch Linux
>
> Configured using:
>  'configure --with-pgtk --with-native-compilation=aot --sysconfdir=/etc
>  --prefix=/usr --libexecdir=/usr/lib --with-tree-sitter
>  --localstatedir=/var --with-cairo --disable-build-details --with-harfbuzz
>  --with-libsystemd --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2
>  -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat
>  -Werror=format-security -fstack-clash-protection -fcf-protection
>  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g
>  -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
>  'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
>  -Wl,-z,pack-relative-relocs -flto=auto' 'CXXFLAGS=-march=x86-64
>  -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3
>  -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection
>  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
>  -Wp,-D_GLIBCXX_ASSERTIONS -g
>  -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
> Important settings:
>   value of $LANG: en_GB.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: VTerm
>
> Minor modes in effect:
>   magit-auto-revert-mode: t
>   pyvenv-mode: t
>   mu4e-modeline-mode: t
>   consult-denote-mode: t
>   flycheck-indicator-mode: t
>   global-flycheck-eglot-mode: t
>   minions-mode: t
>   doom-modeline-mode: t
>   which-key-mode: t
>   global-atomic-chrome-edit-mode: t
>   marginalia-mode: t
>   all-the-icons-completion-mode: t
>   company-prescient-mode: t
>   prescient-persist-mode: t
>   vertico-multiform-mode: t
>   eros-mode: t
>   hexl-follow-ascii: t
>   eglot-booster-mode: t
>   vertico-mode: t
>   global-diff-hl-mode: t
>   global-git-commit-mode: t
>   global-treesit-auto-mode: t
>   which-function-mode: t
>   global-org-modern-mode: t
>   denote-menu-bar-mode: t
>   shell-dirtrack-mode: t
>   company-quickhelp-mode: t
>   company-quickhelp-local-mode: t
>   global-company-mode: t
>   company-mode: t
>   csv-field-index-mode: t
>   override-global-mode: t
>   server-mode: t
>   repeat-mode: t
>   winner-mode: t
>   electric-pair-mode: t
>   recentf-mode: t
>   delete-selection-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   show-paren-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   buffer-read-only: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   auto-save-visited-mode: t
>
> Load-path shadows:
> ~/src/parsebib/parsebib hides /home/joost/.emacs.d/elpa/parsebib-20230228.1530/parsebib
> ~/.emacs.d/lisp/custom hides /usr/share/emacs/29.4/lisp/custom
> /home/joost/.emacs.d/elpa/transient-20240918.1138/transient hides /usr/share/emacs/29.4/lisp/transient
> /home/joost/.emacs.d/elpa/jsonrpc-1.0.25/jsonrpc hides /usr/share/emacs/29.4/lisp/jsonrpc
> /home/joost/.emacs.d/elpa/eglot-1.17/eglot hides /usr/share/emacs/29.4/lisp/progmodes/eglot
> /home/joost/.emacs.d/elpa/eldoc-1.15.0/eldoc hides /usr/share/emacs/29.4/lisp/emacs-lisp/eldoc
>
> Features:
> (shadow emacsbug goto-addr magit-extras apheleia apheleia-rcs apheleia-dp
> apheleia-formatters apheleia-utils apheleia-log apheleia-formatter-context
> view vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs bug-reference pandoc-mode
> pandoc-mode-utils markdown-mode magit-bookmark magit-submodule magit-blame
> magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
> magit-clone magit-remote magit-commit magit-sequence magit-notes
> magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files
> magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log
> magit-diff smerge-mode magit-core magit-autorevert magit-margin
> magit-transient magit-process epa-file network-stream mailalias
> vertico-buffer misearch multi-isearch kivy-mode combobulate
> combobulate-json combobulate-yaml combobulate-css combobulate-js-ts
> combobulate-python combobulate-html combobulate-query savehist scheme
> combobulate-ui combobulate-display combobulate-ztree combobulate-contrib
> multiple-cursors mc-separate-operations rectangular-region-mode mc-mark-pop
> mc-edit-lines mc-hide-unmatched-lines-mode mc-mark-more sgml-mode facemenu
> mc-cycle-cursors multiple-cursors-core rect combobulate-envelope
> combobulate-manipulation combobulate-procedure combobulate-navigation
> combobulate-misc combobulate-interface combobulate-rules
> combobulate-settings indent-bars-ts indent-bars cap-words superword subword
> pyvenv smiley gnus-cite mm-archive mail-extr qp textsec uni-scripts
> idna-mapping ucs-normalize uni-confusable textsec-check
> display-line-numbers mu4e-settings gnus-dired mu4e mu4e-org
> mu4e-notification mu4e-main smtpmail mu4e-view mu4e-mime-parts mu4e-headers
> mu4e-thread mu4e-actions mu4e-compose mu4e-draft gnus-msg mu4e-search
> mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message flow-fill mu4e-contacts
> mu4e-update mu4e-folders mu4e-context mu4e-query-items mu4e-server
> mu4e-modeline mu4e-vars mu4e-helpers mu4e-config mu4e-window mu4e-obsolete
> emoji-labels emoji multisession sqlite ace-window help-fns radix-tree
> descr-text avy corg guess-language visual-fill-column org-autolist
> org-indent oc-basic mule-util vc-git consult-flycheck consult-denote
> consult display-fill-column-indicator flyspell ispell flycheck-indicator
> flycheck-ledger flycheck-eglot flycheck-posframe flycheck eldoc-box
> jk-input-methods quail solarized-light-theme solarized-theme solarized
> solarized-faces go-translate gt-text-utility gt-engine-echo gt-engine-libre
> gt-engine-chatgpt gt-engine-youdao gt-engine-stardict gt-engine-deepl
> gt-engine-google-rpc gt-engine-google gt-engine-bing gt-extension gt-faces
> gt-core gt-httpx wgrep-ag wgrep csv2ledger vterm bookmark term disp-table
> ehelp vterm-module term/xterm xterm ielm minions doom-modeline
> doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f
> nerd-icons nerd-icons-faces nerd-icons-data nerd-icons-data-mdicon
> nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon
> nerd-icons-data-sucicon nerd-icons-data-wicon nerd-icons-data-faicon
> nerd-icons-data-powerline nerd-icons-data-octicon nerd-icons-data-pomicon
> nerd-icons-data-ipsicon which-key atomic-chrome iimage image+ image-file
> image-converter marginalia all-the-icons-completion company-prescient
> prescient char-fold orderless vertico-multiform dockerfile-mode sh-script
> smie executable impatient-mode htmlize jupyter python-pytest edebug eros
> macrostep checkdoc paredit dape hexl gdb-mi gud eglot-booster eglot
> external-completion jsonrpc flymake-proc flymake diff ert debug backtrace
> org-linenote vertico projectile lisp-mnt grep ibuf-ext ibuffer
> ibuffer-loaddefs ag vc-svn compile find-dired s diff-hl log-view vc-dir
> ewoc vc vc-dispatcher diff-mode git-commit with-editor log-edit pcvs-util
> add-log magit-mode benchmark magit-git magit-base magit-section
> cursor-sensor crm autorevert aggressive-indent nswbuff finder-inf yaml-mode
> yaml treesit-auto reftex reftex-loaddefs reftex-vars which-func imenu
> tab-jump-out yasnippet-snippets yasnippet company-org-block org-modern
> org-settings org-clock ob-jupyter jupyter-tramp tramp-cache time-stamp
> jupyter-server jupyter-server-kernel jupyter-rest-api url-http url-auth
> url-gw nsm jupyter-org-extensions jupyter-org-client jupyter-repl
> jupyter-widget-client websocket bindat simple-httpd jupyter-client
> jupyter-kernel jupyter-monads jupyter-messages hmac-def jupyter-mime
> jupyter-kernelspec jupyter-env jupyter-base eieio-base ob-sqlite ob-sql
> ob-shell ob-clojure ob-python python treesit ol-w3m org-tempo tempo
> ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015
> mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start
> gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
> gnus-range message sendmail yank-media rfc822 mml mml-sec epa derived epg
> rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
> rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win ol-eww eww
> thingatpt shr pixel-fill kinsoku svg puny mm-url gnus nnheader gnus-util
> text-property-search mail-utils range mm-util mail-prsvr ol-doi
> org-link-doi ol-docview doc-view filenotify jka-compr image-mode exif
> ol-bibtex ol-bbdb org-element org-persist xdg org-id org-refile avl-tree
> dom org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
> ob-comint org-pcomplete org-list org-footnote org-faces org-entities
> noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
> org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
> cal-loaddefs org-version org-compat org-macs transient compat compat-30
> denote dired dired-loaddefs tramp tramp-loaddefs trampver tramp-integration
> tramp-compat shell pcomplete comint ansi-osc parse-time format-spec
> ansi-color mixed-pitch face-remap biblio biblio-download biblio-dissemin
> biblio-ieee biblio-hal biblio-dblp biblio-crossref biblio-arxiv timezone
> biblio-doi biblio-core let-alist url-queue url-file ido hl-line bibtex
> iso8601 time-date adaptive-wrap goggles comp comp-cstr warnings rx pulse
> color posframe hydra lv use-package-bind-key company-quickhelp pos-tip
> all-the-icons all-the-icons-faces data-material data-weathericons
> data-octicons data-fileicons data-faicons data-alltheicons company-keywords
> company-etags etags fileloop xref project company-gtags
> company-dabbrev-code company-dabbrev company-ipa company-files
> company-clang company-cmake company-semantic company-template company-css
> company-capf company use-package-ensure whitespace literate-scratch
> jk-functions advice csv-mode sort dash eshell esh-cmd generator esh-ext
> esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util files-x
> notifications dbus xml use-package-core cl-extra help-mode edmacro kmacro
> bind-key server repeat winner ring elec-pair recentf tree-widget delsel
> help-at-pt cus-edit pp cus-load icons wid-edit
> all-the-icons-completion-autoloads all-the-icons-autoloads
> apheleia-autoloads easy-mmode async-autoloads avy-autoloads
> boxquote-autoloads breadcrumb-autoloads citar-autoloads citeproc-autoloads
> clojure-mode-autoloads company-auctex-autoloads auctex-autoloads tex-site
> company-box-autoloads company-prescient-autoloads
> company-quickhelp-autoloads consult-denote-autoloads
> consult-flycheck-autoloads corg-autoloads csv-mode-autoloads dape-autoloads
> denote-autoloads devdocs-browser-autoloads diff-hl-autoloads
> docker-autoloads dockerfile-mode-autoloads doom-modeline-autoloads
> eglot-booster-autoloads eldoc-box-autoloads embark-consult-autoloads
> consult-autoloads embark-autoloads eros-autoloads expand-region-autoloads
> flycheck-clj-kondo-autoloads flycheck-eglot-autoloads eglot-autoloads
> eldoc-autoloads go-translate-autoloads goggles-autoloads gptel-autoloads
> guess-language-autoloads hydra-autoloads ialign-autoloads
> impatient-mode-autoloads htmlize-autoloads indent-bars-autoloads
> company-autoloads js2-mode-autoloads json-process-client-autoloads
> jsonian-autoloads jsonrpc-autoloads jupyter-autoloads kivy-mode-autoloads
> ledger-mode-autoloads literate-scratch-autoloads lv-autoloads
> macrostep-autoloads magit-autoloads magit-section-autoloads
> marginalia-autoloads markdown-mode-autoloads minions-autoloads
> multiple-cursors-autoloads nerd-icons-autoloads numpydoc-autoloads
> nushell-ts-mode-autoloads orderless-autoloads org-linenote-autoloads
> org-modern-autoloads paredit-autoloads parsebib-autoloads
> pdf-tools-autoloads pos-tip-autoloads posframe-autoloads
> prescient-autoloads projectile-autoloads python-pytest-autoloads
> realgud-autoloads realgud-recursive-autoloads loc-changes-autoloads
> load-relative-autoloads f-autoloads simple-httpd-autoloads
> sly-overlay-autoloads sly-autoloads solarized-theme-autoloads
> string-inflection-autoloads tab-jump-out-autoloads tablist-autoloads
> test-simple-autoloads tide-autoloads flycheck-autoloads dash-autoloads
> track-changes-autoloads transient-autoloads treesit-auto-autoloads
> vertico-autoloads vterm-autoloads vundo-autoloads web-mode-autoloads
> websocket-autoloads which-key-autoloads with-editor-autoloads info
> compat-autoloads yaml-autoloads yaml-mode-autoloads
> yasnippet-snippets-autoloads yasnippet-autoloads zmq-autoloads package
> browse-url url url-proxy url-privacy url-expand url-methods url-history
> url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
> url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json
> subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
> pcase rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
> vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win
> term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe
> tabulated-list replace newcomment text-mode lisp-mode prog-mode register
> page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar
> mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
> nadvice seq simple cl-generic indonesian philippine cham georgian
> utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese
> eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic
> indian cyrillic chinese composite emoji-zwj charscript charprop case-table
> epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
> loaddefs theme-loaddefs faces cus-face macroexp files window
> text-properties overlay sha1 md5 base64 format env code-pages mule custom
> widget keymap hashtable-print-readable backquote threads dbusbind inotify
> dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
> lcms2 multi-tty make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 1406460 189413)
>  (symbols 48 81849 6)
>  (strings 32 459186 19206)
>  (string-bytes 1 12806777)
>  (vectors 16 178171)
>  (vector-slots 8 4425380 245877)
>  (floats 8 2187 1021)
>  (intervals 56 19925 5482)
>  (buffers 984 49))

-- 
Joost Kremers
Life has its moments





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2024-09-21 10:34 UTC (permalink / raw)
  To: Joost Kremers, João Távora; +Cc: 73355

> From: Joost Kremers <joostkremers@fastmail.fm>
> Date: Thu, 19 Sep 2024 14:01:08 +0200
> 
> 
> I tried to use 'eglot-rename' to rename a variable to a name that already
> existed in the relevant function. The change was not applied but Eglot
> nonetheless reported "[eglot] Edit successful!".
> 
> This was in a Python buffer, using python-ts-mode and basedpyright
> (v1.17.1) as language server. The relevant code snippet:
> 
> ```
> def main():
>     sizes = [100, 1000, 10000]
>     results: dict[str, list[float]] = {
>         "Linear search": [],
>         "Binary search": [],
>         "Interpolation search": [],
>     }
>     for size in sizes:
>         seq: list[int] = sorted([random.randint(0, 10000) for _ in range(size)])
>         x = random.choice(arr)
>         results["Linear search"].append(measure_time(linear_search, arr, x))
>         results["Binary search"].append(measure_time(binary_search, arr, x))
>         results["Interpolation search"].append(
>             measure_time(interpolation_search, arr, x)
>         )
> ```
> 
> Note the 'seq' variable in the first line of the for loop, and the 'arr'
> variable in the three '.append' invocations. With point on the first 'arr',
> calling eglot-rename and giving 'seq' as the new name, Eglot refuses to
> rename the three occurrences of 'arr' (which makes sense, given that a
> variable with that name obviously already exists), but still reports
> success.
> 
> (Note that there is no problem if the 'seq' above is also 'arr'. Then
> renaming works fine.)

Adding João.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  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 22:46     ` Joost Kremers
  0 siblings, 2 replies; 13+ messages in thread
From: João Távora @ 2024-09-21 11:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Joost Kremers, 73355

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

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.

It's possible Eglot is just successfully applying 0 edits.

João

[-- Attachment #2: Type: text/html, Size: 500 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  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:46     ` Joost Kremers
  1 sibling, 1 reply; 13+ messages in thread
From: Joost Kremers @ 2024-09-21 12:12 UTC (permalink / raw)
  To: João Távora; +Cc: 73355, Eli Zaretskii

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.

Sure, I'll do that later today or tomorrow.

> It's possible Eglot is just successfully applying 0 edits.

I guess that's one way of looking at it. :-)

-- 
Joost Kremers
Life has its moments





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-09-21 12:12     ` Joost Kremers
@ 2024-09-21 20:15       ` João Távora
  2024-09-21 22:04         ` Joost Kremers
  0 siblings, 1 reply; 13+ messages in thread
From: João Távora @ 2024-09-21 20:15 UTC (permalink / raw)
  To: Joost Kremers; +Cc: 73355, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

On Sat, Sep 21, 2024, 13:13 Joost Kremers <joostkremers@fastmail.fm> wrote:.

>
> > It's possible Eglot is just successfully applying 0 edits.
>
> I guess that's one way of looking at it. :-)
>

I'm say this because Eglot has no logic to check if a rename is valid or
not. It just does what the server tells it to. If the intended rename is
invalid, the server can error out (and Eglot will tell you this) out return
0 edits. Either way, the server calls all the shots.

João

>

[-- Attachment #2: Type: text/html, Size: 1112 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Joost Kremers @ 2024-09-21 22:04 UTC (permalink / raw)
  To: João Távora; +Cc: 73355, Eli Zaretskii

On Sat, Sep 21 2024, João Távora wrote:
> On Sat, Sep 21, 2024, 13:13 Joost Kremers <joostkremers@fastmail.fm>
> wrote:.
>
>>
>> > It's possible Eglot is just successfully applying 0 edits.
>>
>> I guess that's one way of looking at it. :-)
>>
>
> I'm say this because Eglot has no logic to check if a rename is valid or
> not. It just does what the server tells it to. If the intended rename is
> invalid, the server can error out (and Eglot will tell you this) out return
> 0 edits. Either way, the server calls all the shots.

Ah, OK, I didn't realise that. So does the server report it made 0 edits?
If it does, would it make sense to have Eglot say no changes were made?

As soon as I have some time, I'll see if I can find out a bit more and
possibly take it up with the basedpyright people.

Thanks,

Joost


-- 
Joost Kremers
Life has its moments





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-09-21 22:04         ` Joost Kremers
@ 2024-09-21 22:31           ` João Távora
  0 siblings, 0 replies; 13+ messages in thread
From: João Távora @ 2024-09-21 22:31 UTC (permalink / raw)
  To: Joost Kremers; +Cc: 73355, Eli Zaretskii

On Sat, Sep 21, 2024 at 11:04 PM Joost Kremers <joostkremers@fastmail.fm> wrote:

> Ah, OK, I didn't realise that. So does the server report it made 0 edits?

I don't know, you haven't supplied that part of the report yet.

> If it does, would it make sense to have Eglot say no changes were made?

Maybe.  Some sense. But IMO it would make even more sense for the
server to error out.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-09-21 11:43   ` João Távora
  2024-09-21 12:12     ` Joost Kremers
@ 2024-09-21 22:46     ` Joost Kremers
  2024-10-05  9:57       ` Eli Zaretskii
  1 sibling, 1 reply; 13+ messages in thread
From: Joost Kremers @ 2024-09-21 22:46 UTC (permalink / raw)
  To: João Távora; +Cc: 73355, Eli Zaretskii

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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-09-21 22:46     ` Joost Kremers
@ 2024-10-05  9:57       ` Eli Zaretskii
  2024-10-19  7:03         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2024-10-05  9:57 UTC (permalink / raw)
  To: joaotavora, Joost Kremers; +Cc: 73355

Ping!

> From: Joost Kremers <joostkremers@fastmail.fm>
> Cc: Eli Zaretskii <eliz@gnu.org>,  73355@debbugs.gnu.org
> 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/s
 earch.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
> 





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-10-05  9:57       ` Eli Zaretskii
@ 2024-10-19  7:03         ` Eli Zaretskii
  2024-11-02 11:43           ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2024-10-19  7:03 UTC (permalink / raw)
  To: joaotavora, joostkremers; +Cc: 73355

Ping! Ping!

> Cc: 73355@debbugs.gnu.org
> Date: Sat, 05 Oct 2024 12:57:20 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Ping!
> 
> > From: Joost Kremers <joostkremers@fastmail.fm>
> > Cc: Eli Zaretskii <eliz@gnu.org>,  73355@debbugs.gnu.org
> > 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
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-10-19  7:03         ` Eli Zaretskii
@ 2024-11-02 11:43           ` Eli Zaretskii
  2024-11-02 13:26             ` João Távora
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2024-11-02 11:43 UTC (permalink / raw)
  To: joaotavora, joostkremers; +Cc: 73355

Ping! Ping! Ping!

> Cc: 73355@debbugs.gnu.org
> Date: Sat, 19 Oct 2024 10:03:06 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Ping! Ping!
> 
> > Cc: 73355@debbugs.gnu.org
> > Date: Sat, 05 Oct 2024 12:57:20 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > Ping!
> > 
> > > From: Joost Kremers <joostkremers@fastmail.fm>
> > > Cc: Eli Zaretskii <eliz@gnu.org>,  73355@debbugs.gnu.org
> > > 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/s
 rc/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
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#73355: 29.4; eglot-rename reports success when it shouldn't
  2024-11-02 11:43           ` Eli Zaretskii
@ 2024-11-02 13:26             ` João Távora
  0 siblings, 0 replies; 13+ messages in thread
From: João Távora @ 2024-11-02 13:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joostkremers, 73355

Sorry for the silence, but I don't have time to work on this right
now, and I don't find the issue serious enough to warrant urgency.
In fact, it could be argued that this isn't an issue at all.  If I give
someone no work to do, they might well announce that they have
done all the work I have given them.

But someone can propose a patch to Eglot that detects when the
changes proposed by the server are an empty set and report
something that indicates that somehow.  Or instead of "rename
successful", Eglot could report the more laconic "All server changes
performed".  Or not report anything at all.

João

On Sat, Nov 2, 2024 at 11:43 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> Ping! Ping! Ping!
>
> > Cc: 73355@debbugs.gnu.org
> > Date: Sat, 19 Oct 2024 10:03:06 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> >
> > Ping! Ping!
> >
> > > Cc: 73355@debbugs.gnu.org
> > > Date: Sat, 05 Oct 2024 12:57:20 +0300
> > > From: Eli Zaretskii <eliz@gnu.org>
> > >
> > > Ping!
> > >
> > > > From: Joost Kremers <joostkremers@fastmail.fm>
> > > > Cc: Eli Zaretskii <eliz@gnu.org>,  73355@debbugs.gnu.org
> > > > 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
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-11-02 13:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).