unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
@ 2024-02-27 12:59 Chmouel Boudjnah
  2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-27 13:33 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Chmouel Boudjnah @ 2024-02-27 12:59 UTC (permalink / raw)
  To: 69426

When using eglot-rename it asks for a new name (for the variable for
example) to rename to, it would be nice if there was a way to have the
current thing-at-point suggested as the new name.

Usually when renaming a variable you want to rename it to something that
is related to the current name with the defautl behavior you have to
type the current name manually.

I have a function like this that does it:

  (defun my-eglot-rename (newname)
    "Rename the current symbol to NEWNAME with initial input a."
    (interactive
     (list (read-from-minibuffer
            (format "Rename`%s' to: " (or (thing-at-point 'symbol t)
                                          "unknown symbol"))
            (or (thing-at-point 'symbol t) "") nil nil nil
            (symbol-name (symbol-at-point)))))
    (eglot--server-capable-or-lose :renameProvider)
    (eglot--apply-workspace-edit
     (jsonrpc-request (eglot--current-server-or-lose)
                      :textDocument/rename
`(,@(eglot--TextDocumentPositionParams)
                                             :newName ,newname))


which probably can work as advice to eglot-rename but it would be nice
if we can have this builtin.





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

end of thread, other threads:[~2024-02-27 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 12:59 bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming Chmouel Boudjnah
2024-02-27 13:29 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-27 13:32   ` Chmouel Boudjnah
2024-02-27 15:59     ` Eli Zaretskii
2024-02-27 13:33 ` Eli Zaretskii
2024-02-27 13:37   ` Chmouel Boudjnah

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