Code Style

Last modified: 27 February 2025

Scheme

In this area, choose the code style scheme and change it as required. Code style scheme settings are automatically applied every time IntelliJ IDEA generates, refactors, or reformats your code.

The IDE comes with two pre-defined schemes: the Project scheme and the Default scheme.

  • In the Project scheme, the settings that you configure apply only to your current project.

    These settings are stored in the codeStyles folder under .idea and are shared through VCS together with the project.

  • In the Default scheme (IDE-level scheme), the settings that you configure apply to all existing projects that have the Default code style scheme selected.

Item Description
Scheme From this list, select the scheme to be used. The predefined schemes are shown bold. The custom schemes are in plain text.

General

Line Separators

IntelliJ IDEA lets you configure line separator and indentation options for various languages.

Item Description
Line Separator Use this list to specify which line separator is to be used in files created by IntelliJ IDEA. The available options are:
  • System-Dependent: select this option to use the separator default for your OS.
  • Unix and macOS: select this option to use the Unix and macOS line separator.
  • Windows: select this option to use the Windows line separator.
  • Classic Mac OS: select this option to use the \r line separator. |

Indents detection

Select Detect and use existing file indents for editing to detect the indentation style in the current file and use this style instead.

EditorConfig

Select the Enable EditorConfig support checkbox to use EditorConfig for code style.

Formatter

In this area, specify the markers to limit code fragments that you want to exclude from reformatting.

Item Description
Do not format In the Do not format field, specify a glob pattern with the names of files and directories that you want to exclude from reformatting.

| Off: | In this field, specify the character string that will indicate the beginning of a code fragment which you want to exclude from reformatting. | | On: | In this field, specify the character string that will indicate the end of a code fragment which you want to exclude from reformatting. |