Somehow, I managed to break my refactoring capabilities in Intellij IDEA 12. I have somehow disabled it for my project. Renaming a member through Shift+F6 doesn't work. The inline edit box is not drawn, nothing happens.
I know of the refactoring settings in Settings -> Editor
, Enable in-place mode
and Preselect old name
are both checked.
It has to be some kind of project setting. I checked by creating a test project, adding some member and renaming it, which works perfectly.
What setting am I looking for? Or could my project be broken?
The only way to rename files seems to be Shift+F6 which attempts to find all usages which takes too long (~30s - 1min).
In the editor, highlight or place the caret at a type you want to refactor. Press Ctrl+Shift+F6 or on the main menu, select Refactor | Type Migration. In the dialog that opens, specify the new type and scope where to look for the usages. Preview and apply the changes.
There is no way to turn refactoring off in the settings. My guess is that the project's cache/indexes are corrupted. I had a case once where refactoring, especially renames, stopped working. A re-index solved it for me. Go to File >Invalidate Caches, invalidate your caches, restart IDEA, and let IDEA re-index the project (progress is shown in the bottom status bar right of center). Then try the refactoring.
If that does not solve it, take a look in the logs (Help > Show Log) and see if there is any indication in there as to the cause of the issue.
Fo all the MacOS users, do not forget to access Settings -> Keyboard
and turn on the flag for the option Use all F1, F2, etc. keys as standard function keys
. E.g.:
Otherwise IntelliJ will not get the focus to use the F4 key.
Following step worked for me:
From your IDE, go to: Preferences -> Project Structure -> Add Content Root
, then select the folder you want to use.
None of the above steps worked for me in IDEA 2021.2.4 (Ultimate Edition). I got the following error message when trying to rename a file and its usages:
Cannot perform refactoring. Selected file is not located inside the project.
Instead, I had to create a new module.
File > Project Structure > Modules > Add (+) > Import module > Select <root_folder_of_your_project>
This reindexed the whole project, which took a couple of minutes, and restored the Refactor > Rename functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With