Is your enhancement request related to a problem? Please describe.
On textDocument/prepareRename requests, hls-rename-plugin returns either of the following:
{defaultBehavior: true} if the cursor is on a Name identifier, which can be renamed
{defaultBehavior: false} if the cursor is anywhere else, to signal that renaming is not supported
There are two disadvantages:
- HLS depends on the client to support
defaultBehavior. (This affected the Zed editor back in 2025, when it did not yet support defaultBehavior.)
- HLS does not agree with the LSP specification, which says that if a
rename request is invalid, the server should return null. (This affects Emacs users to this day.)
Describe the solution you'd like
prepareRenameProvider should simply return the range of the identifier at the cursor position, using the HIE AST (which it already uses to verify that the cursor is on a Name identifier).
It should also return null for invalid requests.
It might be possible to stop relying on defaultBehavior altogether.
Describe alternatives you've considered
At first I tried just replacing {defaultBehavior: false} with null, but my Emacs setup still occasionally failed to perform renaming.
Additional context
I think there’s none.
Is your enhancement request related to a problem? Please describe.
On
textDocument/prepareRenamerequests,hls-rename-pluginreturns either of the following:{defaultBehavior: true}if the cursor is on aNameidentifier, which can be renamed{defaultBehavior: false}if the cursor is anywhere else, to signal that renaming is not supportedThere are two disadvantages:
defaultBehavior. (This affected the Zed editor back in 2025, when it did not yet supportdefaultBehavior.)renamerequest is invalid, the server should returnnull. (This affects Emacs users to this day.)Describe the solution you'd like
prepareRenameProvidershould simply return the range of the identifier at the cursor position, using the HIE AST (which it already uses to verify that the cursor is on aNameidentifier).It should also return
nullfor invalid requests.It might be possible to stop relying on
defaultBehavioraltogether.Describe alternatives you've considered
At first I tried just replacing
{defaultBehavior: false}withnull, but my Emacs setup still occasionally failed to perform renaming.Additional context
I think there’s none.