-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Try lsp_rename
but default to current_word
#48
Comments
Appreciate your kind words. I've been considering the different edge cases of this implementation. Specifically, on adding this behavior to one of the existing methods. LSP rename is a better fit to include a gracefully degraded behavior that changes the current word when there are no LSP attached servers. What stops me on this approach is the user expects a LSP renaming. If there are no available servers, in fact, the word casing is changed but the user does not get feedback it actually failed to LSP rename all the instances Overall I agree on your suggestion. Do you have thoughts regarding the DX/UX? |
I totally get where you're coming from. The suggestion I made was more of a general concept. I wouldn't recommend altering any existing functions; perhaps adding a new function would be the way to go. This way, users can decide which one to map. I have two other questions:
|
@tummetott it can be a new function as you suggested. Do you think you can create a PR? That one sounds easy since it is a new feature (non breaking change) and is based on existing behavior. If not I can add also add it About your questions:
|
Hello @johmsalas, After further experimentation with the suggested change, I've concluded that bundling By the way, not calling |
Something that resonated to me in the issue is there are too many keybindings, I didn't notice it until stopped programming for a while and then came back, there is a learning curve I'd like to get rid of. How about attempt to lsp rename, if it fails.. for any reason, like not being available in the attached LSP, default to current_word? |
I had exactly the same thought but i had not idea how to probe if a LSP rename would work or fail without doing the actual rename. If you find a solution, that would be the best option i guess |
This plugin uses buf_request, which seems to be deprecated o.O It should be replace by |
Related: #57 |
@tummetott I'm starting to work on #57 and will include an example of failed LSP rename |
Added an example of LSP failure in this PR In order to implement the LSP_rename_or_current_word method, we should create another method, similar to lsp_rename. |
I'm not sure if we want to call M.current_word or M.quick_replace 🤔 |
Hello,
First and foremost, I'd like to express my appreciation for this excellent plugin.
While reading through the readme documentation, I noticed that there are quite a few suggested keymaps for usage . I believe that when someone is in the process of refactoring a variable to a different case, and a language server is active, the natural inclination is to use the rename feature provided by the language server. Only in cases where there is no language server running would a simple refactor of the current word be desired. Is it truly necessary to have separate keymaps for these scenarios?
I've considered the possibility of combining
lsp_rename
andcurrent_word
into a single keymap function, but this approach seems to introduce a significant amount of boilerplate code, as shown here:This led me to wonder if it might be feasible to integrate this behavior directly into the plugin. By doing so, you could expose just one function to users, simplifying the keymapping process and enhancing the overall user experience.
The text was updated successfully, but these errors were encountered: