On Sun, Aug 20, 2023, 23:52 Dmitry Gutov <dmitry@gutov.dev> wrote:
On .

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.

Philip K. has proposed a patch to Eglot that implements this in bug#60338.  It is not without problems, but was generally agreeable to me. Would you have a look, Dmitry? We stalled while thinking about the user confirmation model...

Anyway, are we aiming at making Eglot and LSP the only provider of refactoring in Emacs? If we aren't, then I think we should be working on a compatibility layer (which can be modeled after LSP's request/proposal mechanism) even if -- for the time being -- LSP/Eglot is the only provider. That move would inherit a lot of code from Eglot related to applying the changes, confirming etc, meaning those details would already be solved. 

João