The JetBrains Guide is shutting down on March 30, 2026. more...

Refactoring

Refactoring code for understanding.

While trying to understand the code, you may want to perform small refactorings, like renaming a variable or method using Refactor | Rename ⇧F6 (macOS) / Shift+F6 (Windows/Linux), Extract Method using ⌥⌘M (macOS) / Ctrl+Alt+M (Windows/Linux) to extract a method and giving it a meaningful name, or refactoring the code to a style you are more familiar with to make it easier for you to read and understand the code, for example using Intention Actions ⌥⏎ (macOS) / Alt+Enter (Windows/Linux). Playing with the code can help you verify your assumptions and improve your understanding. Remember though, that these changes are not meant to be committed. Revert them when you’re done!