You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've relied too much on the built-in surround capabilities, mostly for changing content within. This is really cool for changing the surrounding characters/names themselves.
csf -> change surrounding function is awesome, but it isn't quite usable in an LSP environment. When using an LSP, you can issue vim.lsp.buf.rename() and be able to rename the closest token to your cursor. The new name will be updated everywhere in the project.
Is it possible to have the default handler invoke something similar? Or if anyone is familiar, simply recommend a way to do so? I looked into the vim API docs and didn't see a straightforward way to trigger an LSP rename without navigating to the token first.
The text was updated successfully, but these errors were encountered:
It's basically just hijacking the change key to map csf to call vim.lsp.buf.rename(). The modification to target is to prevent nvim-surround from deleting any text before the LSP rename gets applied. You can probably make this more complex to detect if any attached servers have the rename functionality, otherwise deferring to the "dumb" default functionality
I'm not quite sure what you mean by that---the find key remains unchanged so the cursor will "jump" to the nearest function call, then call vim.lsp.buf.rename().
Summary
First, love this plugin.
I've relied too much on the built-in surround capabilities, mostly for changing content within. This is really cool for changing the surrounding characters/names themselves.
csf
-> change surrounding function is awesome, but it isn't quite usable in an LSP environment. When using an LSP, you can issuevim.lsp.buf.rename()
and be able to rename the closest token to your cursor. The new name will be updated everywhere in the project.Is it possible to have the default handler invoke something similar? Or if anyone is familiar, simply recommend a way to do so? I looked into the vim API docs and didn't see a straightforward way to trigger an LSP rename without navigating to the token first.
The text was updated successfully, but these errors were encountered: