-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Better prefill and completion for :GoRename #1465
Conversation
I like this; it's a good usability improvement. The defaults don't seem to work as you describe, though; I get Can we rename
I don't think we should break people that currently have Can you go ahead and update the CHANGELOG.md simultaneously? |
1. Repurpose `g:go_gorename_prefill` to be an expression, which can transform the value that is pre-filled to the most common forms. The default is to use camelCase when the identifiers starts with a lowercase letter, and CamelCase when it starts with an uppercase letter, which sounds like a reasonable guess to me. 2. Add completion support, so you can use `:GoRename <Tab>` to get the most common options. Both of these changes make it a bit easier/faster to use, especially if you need to rename a bunch of identifiers in a project that doesn't follow Go standards (like I had to do last week).
- Rename `camelcaseExported` to `pascalcase`. - `g:go_gorename_prefill=1` is an alias for the default, for compatibility reasons.
Hm, it seems to work for me; with this file:
if I press Maybe you did something different?
Yeah, this sounds better 👍
Sure, this sounds reasonable.
My general strategy with adding ChangeLog entries is to do this right before merging, or after merging when merging multiple PRs. The reason for this is that otherwise it's a forever source of merge conflicts and generally just annoying to deal with. I don't have super-strong feelings on this or anything; maybe best to discuss on Slack how to best deal with this in future PRs? |
This isn't quite what it does, though. Maybe that was actually also the confusion about your other comment? It tries to preserve the capitalisation of the first character, this matters because otherwise renaming something like I've (hopefuly) clarified the docs a bit, let me know what you think. |
Yes, that was the source of my confusion. Thank you for updating the docs! I'm good with postponing the CHANGELOG.md until post-merge; I'm short on time now, but will try to update it later if you don't get to it first. LGTM. |
Thanks; I've updated the ChangeLog. |
g:go_gorename_prefill
to be an expression, which cantransform the value that is pre-filled to the most common forms.
The default is to use camelCase when the identifiers starts with a
lowercase letter, and CamelCase when it starts with an uppercase
letter, which sounds like a reasonable guess to me.
:GoRename <Tab>
to get themost common options.
Both of these changes make it a bit easier/faster to use, especially if
you need to rename a bunch of identifiers in a project that doesn't
follow Go standards (like I had to do last week).