Skip to content

implement IDE agnostic configuration with editorconfig.org #16543

@Pankraz76

Description

@Pankraz76

Addressing the comment and issue of people use a lot of editors and very different versions, which is a valid concern—one good approach to handling this is using EditorConfig.

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

Applying a strictly enforced style can be challenging without a universal solution. .editorconfig provides a way to configure the editor out of the box, making it easier to maintain consistency. The project supports many different editors, including IntelliJ, Eclipse, and VS Code. On IntelliJ, for example, it works by default, following the convention over configuration principle.

Many projects face similar issues, so it makes sense to adopt a widely used and well-supported solution as well.

Examples of projects using .editorconfig:

Relevant discussion:

This is the config representing the rules enforced by checkstyle:

[*]
charset = utf-8
end_of_line = lf
ij_continuation_indent_size = 4
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 100

[*.xml]
indent_size = 2

[pom.xml]
max_line_length = 140

[*.java]
ij_java_class_count_to_use_import_on_demand = 999
ij_java_else_on_new_line = true
ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, net.**, |, com.**, |, *
ij_java_names_count_to_use_import_on_demand = 999

[**xdocs-examples**.java]
ij_continuation_indent_size = 2
indent_size = 2

https://editorconfig.org/#pre-installed

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions