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
- Position the caret over the identifier (namespace, type, method, field, etc) you want to rename.
- Press Alt+Insert. From the pop-up menu, select Rename.
Enter the new name.
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.
- Press Enter to finish or Esc to abort the operation.
In case the rename operation requires modification in files that are not currently opened in the editor, JustCode will ask your for confirmation.
- 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 JustCode automatically changes all occurrences of the renamed identifier in the editor as you type.
- Position the caret over the identifier of the private member you want to rename.
- Press Alt+Insert. From the pop-up menu, select Rename.
Start typing the new name.
- Notice how JustCode highlights the other identifiers and automatically changes their name.
- Press Enter to finish or Esc to abort the operation.
Renaming a namespace
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 Symbol | Operation |
|---|
| Namespace | Renames a namespace in declaration, using statements, and fully qualified names. |
| Type | Renames 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. |
|
| Field | Renames a field and updates all references to that field. |
| Property | Renames a property and updates all references to that property. |
| Event | Renames an event and updates all references to that event. |
| Parameter | Renames a method/constructor parameter and updates all references to that parameter. |
| Local variable | Renames 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