emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding refactoring capabilities to Emacs


From: Dmitry Gutov
Subject: Re: Adding refactoring capabilities to Emacs
Date: Mon, 21 Aug 2023 01:51:44 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 20/08/2023 11:44, Yuri Khan wrote:
On Sun, 20 Aug 2023 at 08:20, Dmitry Gutov<dmitry@gutov.dev>  wrote:

If we had a better UI for renaming than query-replace, we could plug it
into project-find-regexp and xref-find-references' output buffers.

Where you currently can hit 'r' to switch to renaming action, it could
instead show the proposed operation (in some fashion) and how the text
will look "after". That would cover the regexp-replace and the
rename-symbol refactorings. Just the basics, but still. Those could also
be combined into separate commands (such as
xref-find-references-and-replace).
Renaming is already possible in Eglot, with the following UI: You
stand on a symbol and invoke eglot-rename. It asks you for the new
name, then does the right thing.

Indeed: we do have access to a bunch of refactorings already through Eglot. Some general, and some language-specific ones.

What we don't have is any advanced UI coming with that. Traditional IDEs (and apparently even VS Code now: https://bobbyhadz.com/images/blog/rename-variable-vscode/refactor-preview.webp) have been featuring the "preview changes" feature for years. One where you could see which files will be affected, and even opt out from some of the changes.

It seems like the LSP protocol provides enough information for this to work (the response to the "rename" action is a list of changes to be performed on the client), so the UI can definitely be extended there.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]