Rename dialog for a variable
Use this dialog to rename a variable.
In addition to renaming the variable itself, PyCharm can also look for the usages of the variable name. If found, the changes you are making to the variable name can also be applied to these usages.
The usages are assigned to different categories which correspond to the options which you can turn on and off.
Note that regardless of the options selected, the search scope (places where you search for the name occurrences) is always limited to the current entity (for example, a file, or a class) and the entities that the current one depends on.
Item | Description |
---|---|
Rename <variable> and its usages to | Specify a new name for the variable. |
Search in comments and strings | If this checkbox is selected, PyCharm will look for occurrences of the variable name within comments and string literals in your source code files. |
Rename parameters in hierarchy | If this option is on, PyCharm will look for occurrences of the variable name in the names of its inheritors. If you are renaming a class, PyCharm will search the hierarchies of the classes that extend this class. |
Search in loaded sources | If this checkbox is selected, PyCharm will look for occurrences of the variable name within downloaded object sources. |
Preview pane | The statement to be run to rename the table or column. If necessary, you can edit the statement right in this pane. |
Refactor | Execute the statement and make associated changes right away. |
Preview | Preview potential associated changes prior to executing the statement. |
Search for text occurrences | If this option is on, PyCharm will look for occurrences of the variable name in the files that don't contain source code. These may be the text files, properties files, HTML files, documentation files, and so on. |
Scope | Use this option to set a scope for the Rename refactoring. For example, you can limit the refactoring to only recently changed files, or to only open files, and so on. You can also create a custom scope that you can either share or keep local. |