Format code
You can reformat:
- A block of code in a source file.
- Whole source files.
- All the source files in a directory or in a project module.
More information about reformatting code in the IntelliJ IDEA documentation.
Reformat a block of code
- In the editor, select the block you want to reformat.
- Select Code > Reformat Code on the main menu.
Reformat all the source files in a directory or project module
- In the Project tool window, right-click a module or a directory and select Reformat Code.
- In Reformat Code, select the options you need and then Run.
Configuration settings
To manage reformat configuration settings, select File > Settings > Editor > Code Style on the main menu.