On this page:
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 suggested name appears right below the symbol in question. You can either accept suggestion, or type a new name.
- If CLion detects the symbol occurrences in comments and strings, it suggests you to
extend refactoring to that usages as well:
In this case:
- Choose Show Usages to view that usages in Find Tool Window.
- Choose Rename Only Code Usages to apply refactoring to code usages only.
- Choose Rename All Usages to rename both code and non-code usages.
- Click Cancel to terminate and return back.
- 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 CLion apply changes to comments and strings.
Press Preview to observe possible changes in Find Tool Window. Press Refactor to proceed.CLion 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.