Pergunta

Rename is pretty much the only refactor tool that I use but I can't get the in-place feature to work. Also the refactor is always across my entire solution where I usually want only the project, namespace, file or method.

So how to get Resharper Rename working in-place on a selectable scope?

PS: if the in-place rename has the current file as default, that would be fine to.

Foi útil?

Solução

To limit the scope of what you are renaming you could try the Rename with Preview functionality. For example, starting with the code below and a requirement to rename "emp" to "employee"

enter image description here

what I did was rename emp to employee in the foreach line:

enter image description here

then click the little red indicator (smart tag) that appears to the bottom right of the renamed variable. That brings up a context menu where "Rename with Preview" can be selected.

enter image description here

That menu option brings up a dialog where instances can be checked or unchecked as desired to limit the scope of the renaming operation.

enter image description here

This may vary depending on the versions of Visual Studio and ReSharper that you are using but it definitely works for Visual Studio 2010 and ReSharper 7 as that's what I tested it on.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top