Obviously, you have a number of standards and guidelines that you have to obey when creating source code. IntelliJ IDEA helps maintain the required code style.
The code styles are defined at the project level and at the global level.
- Project level
Settings at the project level are grouped under the Project scheme, which is predefined and is marked in bold font. The Project style scheme applies to the current project only.
If you want to use a different project level scheme, choose the desired scheme and copy its settings to project.
- Global level
Settings at the global level are grouped under the predefined Default scheme, and any other scheme created by the user. The global settings are used when the user doesn't want to keep code style settings with the project, and share them.
Default scheme cannot be changed! When any modifications are made, IntelliJ IDEA automatically creates a copy of the default scheme.
- Open the Project Settings dialog box, click Code Style, and then click the language in question.
- Choose the code style scheme to be used as the base for your custom coding style for the selected language.
- Browse through the tabs of the selected language page, and configure code style preferences for it.
For most of the supported languages, you can copy code style settings from other languages or frameworks. To do that, choose the desired language to be modified, and click the link Set From in the upper-right corner. This link appears for those languages only, where defining settings on the base of the other languages is applicable. In the drop-down list that appears, click the language to copy code style from: