IntelliJ IDEA
 
Get IntelliJ IDEA

EditorConfig

Last modified: 22 November 2024

IntelliJ IDEA allows you to manage all code style settings for each individual set of files with EditorConfig support.

All you need to do is place an .editorconfig file in the root directory containing the files whose code style you want to define. If you have several code styles in your project (for example, for tests and for production code), you can have several .editorconfig files in corresponding folders in your project. This allows you to follow multiple code style standards at the same time.

All options from the .editorconfig file are applied to the directory where it resides as well as all of its sub-directories on top of the current project code style. If anything is not defined in .editorconfig or other .editorconfig files located in parent directories, it's taken from the current code style scheme. You can find more information about undefined (unset) properties in the EditorConfig documentation.

All options in the .editorconfig file are divided into the following categories:

  • Standard options such as indent_size, indent_style, and so on. These options do not have any domain-specific prefixes.

  • Generic IntelliJ options that have the ij_ prefix and are applicable to all languages:

    • ij_visual_guides

    • ij_formatter_off_tag

    • ij_formatter_on_tag

    • ij_formatter_tags_enabled

    • ij_wrap_on_typing

    • ij_continuation_indent_size

    • ij_smart_tabs

  • Common IntelliJ options are supported by many (but not all) languages. They start with the ij_any prefix, for example, ij_any_brace_style.

  • IntelliJ language-specific options starting with the ij_<lang>_ prefix where <lang> is the language domain ID (normally a low-case language name), for example, ij_java_blank_lines_after_imports.

All IntelliJ .editorconfig properties have corresponding options in the code style scheme and have similar names.

To quickly learn whether the file currently opened in the editor has any code style options that are overridden by properties in an .editorconfig file, use the Indentation widget in the status bar.

The icon in the widget indicates that there's an .editorconfig file that overrides some settings from your current code style scheme.

Indentation widget with EditorConfig icon

Click the widget:

  • Click Open .editorconfig to open the nearest .editorconfig file which affects the file that you're currently working with.

  • Select Show Files Related to Project to open a list of all .editorconfig files in the project.

  • Click Disable for Project to disable EditorConfig support in your project and use settings from your current code style scheme. You can also disable EditorConfig support in settings.

EditorConfig menu opened from the Indentation widget