JustCode

The Rename refactoring allows you to quickly change the name of namespaces, types, methods, fields and practically every type of code you write (see details below). The operation replaces all references in code as well as in comments and string literals (optional).

Note

Language Support

Supported: C#, VB.NET, ASP.NET, JavaScript, Razor, CSS, XAML

Not supported: HTML

The Rename command behaves in different ways depending on what you refactor and whether the files that have to be modified are open or not.

To rename an identifier

  1. Position the caret over the identifier (namespace, type, method, field, etc) you want to rename.
  2. Press Alt+Insert. From the pop-up menu, select Rename.
  3. Enter the new name.

    Rename Select
  4. Choose whether to rename the identifier in comments and/or in string literals (Note: this step is not available in field, method/constructor parameter and local variable rename). In case you rename a class identifier and it is the same as the file name, you can also choose whether to synchronize them.

    Rename Help Popup
  5. Press Enter to finish or Esc to abort the operation.
  6. In case the rename operation requires modification in files that are not currently opened in the editor, Telerik JustCode will ask your for confirmation.

    Rename Confirmation
  7. On this dialog you can confirm or not the rename operation. If you want to be able to undo your changes check "To enable Undo, open all files with changes for editing". To save your choice for future rename operations check "Don't show this dialog again".

Renaming a private member

The flow of renaming a private member is slightly different than the common rename flow. You follow exactly the same procedure, but Telerik JustCode automatically changes all occurrences of the renamed identifier in the editor as you type.

  1. Position the caret over the identifier of the private member you want to rename.
  2. Press Alt+Insert. From the pop-up menu, select Rename.
  3. Start typing the new name.

    Private Rename
  4. Notice how Telerik JustCode highlights the other identifiers and automatically changes their name.
  5. Press Enter to finish or Esc to abort the operation.

Renaming a namespace

Telerik JustCode allows you to rename a namespace completely or change its nesting levels. Consider the following namespace: aaa.bbb.ccc. You can cut the bbb part and it will become aaa.ccc or you could completely rename it to ddd.eee.

Rename Operations

Code SymbolOperation
NamespaceRenames a namespace in declaration, using statements, and fully qualified names.
TypeRenames all declarations and usages of a type (interface, class, struct, or enum), including constructors and destructors. In case the type is declared in a file with the same name, you can choose whether to rename the file name (this is valid only in C# and VB.NET files).
Method

Renames a method and updates all references to that method.

Note

Works with Extension methods also.

FieldRenames a field and updates all references to that field.
PropertyRenames a property and updates all references to that property.
EventRenames an event and updates all references to that event.
ParameterRenames a method/constructor parameter and updates all references to that parameter.
Local variableRenames a local variable and updates all references to that variable.
Note

In case of renaming an implemented/overridden member or a member that implements/overrides other members, JustCode does a cascading update.

Note

In case of renaming anonymous types members changes do not reflect in other anonymous types with the same properties.

Tip

To rename you can also navigate on the main menu. Choose JustCode | Refactor | Rename, or just press Ctrl+R, Ctrl+R

See Also