Refactorings
Code Refactorings in JetForcer
Content:
- Using Code Refactorings
- Rename
- Rename Base Method
- Extract Refactorings
- Change Method Signature
- Safe Delete
- Undo
Using Code Refactorings
To invoke a refactoring use its keyboard shortcut or choose it in the JetForcer's Refactor menu while the caret is placed on a code selection or on a symbol you want to refactor.
You can also call Refactor this from the Refactor menu and JetForcer will show you all refactorings available in the current context.
Rename Refactoring
This feature provides a great assistance in renaming code symbols such as types, fields, properties, methods, local variables, etc. It finds all references and corrects them automatically, which can include usages in comments and strings if corresponding options are set.
Rename works with all supported languages, including Apex, Visualforce, Lightning, SOQL, and others.
Use Refactor -> Rename to invoke this feature.
Rename Base Method Refactoring
When you invoke rename refactoring on a method in a derived class, there is an option that allows to refactor also its base methods.
Extract Refactorings
Apply extract refactorings to literals, expressions or blocks of code to extract constant, variable, method and more.
Change Method Signature Refactoring
Change signature refactoring allows you to:
- Rename method.
- Change return type.
- Change parameters types.
- Add, remove, reorder or rename parameters.
JetForcer finds all usages, including calls, overrides, and implementations, and changes them along with changing the signature. In overriding methods parameter passed to the method is passed to the base call. If you're adding new parameters, you can provide default values for them and they will be substituted in all calls.
Safe Delete Refactoring
Remove files and symbols safely using the Safe Delete refactoring - it searches all usages of an entity before deleting it, so you can explore them and make any changes you need to keep your code valid.
To invoke it call Refactor | Safe Delete from the context or the main menu.
Undo Refactoring
The very handy thing about refactoring is that when you invoke undo after applying it, that will rollback all the changes made by refactoring, no matter how complicated it was.