intellij-ideaeditorconfig

Intellij IDEA - how to override code style config


We have a Java project in small team, all developers use Intellij IDEA.

I need to setup code style so that

How to achieve it?

My attempts:


Solution

  • Finally we decided to treat .editorconfig file as main source of truth. The file is versioned. The IDEA is set to prefer EditorConfig settings over IDEA XML settings. (Ctrl+Alt+S -> Editor -> Code Style -> General -> Enable EditorConfig support)

    The .editorconfig properties such as indent_style = tab are obligatory for all team members. On the other hand, properties such as tab_width intentionally are not in .editorconfig so IDEA consults its own settings (these are not versioned).

    This solution is facilitated by proprietary ij_... keys in .editorconfig. With such properties all IDEA config could be exported to .editorconfig file. When I asked a question 2 years ago, these keys weren't supported or I didn't notice them.