I have a class with many (approximately 40) methods with names in SCREAMING_CASE_LIKE_THIS
.
Is there a quick way, perhaps via the code analysis/inspections, to rename all of these to more idiomatic names in camelCaseLikeThis
?
Press Shift+F6 or from the main menu, select Refactor | Rename. next to the highlighted element. You can press Tab to open the context menu and select the additional rename options. If you want to see the Rename dialog with more options, click the More options link or press Shift+F6 .
Try to set cursor on variable and use shortcut Shift-F6 - after that there are dialog frame for change name of variable and it changes all occurences of variable to setted name.
The most popular refactorings supported in IntelliJ IDEAMakes sure that you do not delete files that are referenced in your source code. Copies/Moves an element. These refactoring actions help you reduce the code duplication. Renames an element.
It's not quite a batch, but if you position the cursor above the first of the methods, start a macro recording then do: control-alt-down shift-f6 down-arrow down-arrow carriage-return
then stop the macro, you now have a macro that goes to the next method and renames it as you desired (camel case, without underscores). You can then assign that macro to a shortcut and repeat the appropriate number of times. I tried adding the last step to the macro as being a key combination which was not bound, then assigning that combination to the macro itself (so it was self calling) but I could not get that to work. Also tried creating another macro which invoked the first x times, but that would also not work for some reason.
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