Home > Refactorings > Refactorings – Rename

Refactorings – Rename

December 25th, 2010

This refactoring provides an easy way to rename identifiers for code symbols such as locals, type members, types or namespaces and updating all their references.

Rename is one of the most useful refactorings of all. The developer can alter the name of the declaration and its occurrences (references) in the code in the whole solution.

Simply put the caret on the identifier and apply the refactoring. The refactoring will wrap all references and name of the declaration into linked identifiers, that help you easily change all occurrences simultaneously. The preview hint in Rename will show visible references in the code editor. Press Enter when you are done changing the name of the identifier to commit your changes.

Refactor! Rename refactoring preview

There are a few options available for this refactoring in the Options Dialog:

Refactor! Rename refactoring options page

  • How the text selection should be changed when the Rename is performed on the identifier, and no selection exist:
    • Identifier will be entirely selected
    • Nothing will ever be selected
    • Smart selection – for example, the identifier will be completely selected in the specific context (e.g. when the caret is at the start of the identifier or immediately left of a lower-case character)
  • Option whether to show the progress visualization hint of the references search:

Refactor! Rename refactoring progress

—–
Products: Refactor! Pro and free alternatives
Versions: 10.1 and up
VS IDEs: any
Updated: Dec/25/2010
ID: R018

Similar Posts: