In this section:
- Renaming a method
- Renaming a template
- Renaming a symbol
- Renaming a file or directory
- Important notes
The following rename refactorings are available in PyCharm:
- Rename Class. The following usages are renamed:
- Rename Method. The following usages are renamed:
- Rename Field.
- Rename Function.
- Rename Variable.
- Rename Parameter. The following usages are renamed:
- Rename CSS color value.
- Rename File.
- Rename Directory.
Renaming a method
| || |
Renaming a template
Rename a template:
So doing, the following usages will be renamed:
Renaming a symbol
To rename a symbol, follow these general steps
- Select the item to be renamed.
- To select a file, click the desired file in the Project Tool Window.
- To select a symbol in the editor, place the caret at the name of the symbol to be renamed.
- To select a symbol in the Project Tool Window, make sure that the members are shown, and then click the desired symbol.
- To select a symbol in the Structure view, click the desired symbol in the Structure tool window.
- Choose on the main menu or on the context menu, or press Shift+F6.
- The subsequent behavior depends on the check box Enable in-place mode (Settings/Preferences dialog, Editor).
- If this check box is selected, the suggested name appears right below the symbol in question. You can either accept suggestion, or type a new name. However, if you press Shift+F6 once more, PyCharm will display the Rename dialog box with more options.
- If this check box is not selected, the Rename dialog box opens immediately.
The set of controls and their names depend on the type of the symbol to be renamed.
- Preview and apply changes.
Renaming a file or directory
To rename a file or directory
- Select a desired file in the Project tool window.
- Choose on the main or context menu or press Shift+F6.
- In Rename File dialog box that opens, specify the new file name. Select Search in comments and strings checkbox to let PyCharm apply changes to comments and strings.
Press Preview to observe possible changes in Find Tool Window. Press Refactor to proceed.PyCharm finds all the occurrences of the file name and changes them respectively.
- Local variables are renamed in-place.
To be able to use the Rename dialog when renaming local variables, you should disable in-place refactoring in the editor settings.
- When renaming Gherkin steps, mind the following limitations: