all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chmouel Boudjnah <chmouel@chmouel.com>
To: 69426@debbugs.gnu.org
Subject: bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming
Date: Tue, 27 Feb 2024 13:59:26 +0100	[thread overview]
Message-ID: <CAKSXASRV+hqV7yRFxtHE8C=r+CRkcQBQy+6d3QhJC1w1PxiD7A@mail.gmail.com> (raw)

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.





             reply	other threads:[~2024-02-27 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 12:59 Chmouel Boudjnah [this message]
2024-02-27 13:29 ` bug#69426: 29.2; Let eglot-rename suggest thing-at-point when renaming 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

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

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

  git send-email \
    --in-reply-to='CAKSXASRV+hqV7yRFxtHE8C=r+CRkcQBQy+6d3QhJC1w1PxiD7A@mail.gmail.com' \
    --to=chmouel@chmouel.com \
    --cc=69426@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.