Let's start by talking about Rename. I view Rename as being one of the “Tier 1” refactorings – the refactoring we absolutely must provide, and which must be of the highest quality. They must be fast, reliable, and easy to use. You’re going to use them often, and we want you to like them a lot.
There’s also an option to see a preview of the changes before they get applied. I think you’ll use the preview the first time, and then turn if off. You don’t need it when the refactoring tool is reliable; you’ve got more important things to do.
Just about anything. The UI is pretty much the same for namespaces, types, fields, locals/args, and methods. For methods we will offer to rename overloads as well.
I argued that we should not support fixing up comments. Our refactorings are designed to be reliable – you can know that when you use them, the result will be what you expect. But we can’t really do comment fixup reliably, since it’s prose, not C# -- the semantics aren’t well defined.
Consider:
class C
{
// 'i' is my favorite variable.
int i;
int F(int i) // <--- rename 'i' here
return i == 0 ? 1 : i * F(i);
}
Go to the marked line & rename ‘i'. If you ask us to update comments, we’ll change the one on the field, as well. That’s probably not what you wanted, but there’s no way for us to know that.
In my not-at-all-humble opinion, if you want to update comments, you should use Find & Replace in Files, instead of the Rename Refactoring. Find/Replace is not very smart, but you expect that, and you already know how to manage it to get the result you want.
However, every time we showed people Rename, their first question was “Will you fix up comments, too?” So, we are including an option to fix up strings.
Normally, no.
If you’re a Refactoring purist, I’ll tell you that we applied the definition of Refactoring (specifically, the “leaves its behavior unchanged” part). If you could toggle off a specific reference, the behavior would change. (Specifically, your code would go from legal to C# to not legal C#.)
If you’re a Refactoring pragmatist, I’ll tell you that Find & Replace in Files has appropriate user interaction model for this kind of activity.
If you elect to Search in Comments, then you get some checkboxes for the comments.
Yes, but only if they’re C# projects. If you have VB and C# projects in the same solution, the VB references won’t be updated.
We have some smarts about renaming between the forms designer, the editor, and the solution explorer. For example, if you follow 1-class-per-file, and you rename a file, it’ll rename the class, too.
Reading this blog, do you think we’re making the right choices in our Rename design?
Are we providing the functionality you expect?
Are there parts of this feature description that look like a waste of our efforts?
When commenting, say where you put yourself on the “Refactoring Purist” scale.