What is EditorConfig?

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems. (Excerpt from official documentation)

Using

  1. Install EditorConfig
    01

  2. Create a .editorconfig file in the root directory of the project
    02

  3. Check the Enable Editor Config Support
    03

  4. Add coding rules
    Refer to the official documentation.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    root = true

    [*]
    end_of_line = crlf
    insert_final_newline = true

    [*.cs]
    indent_style = space
    indent_size = 4
    #tab_width = 4
    charset = utf-8-bom
    trim_trailing_whitespace = true

    dotnet_sort_system_directives_first = true

    ...

Other

  • Check the Organize Imports On Format to sort using.
    04

References

  1. editorconfig for VSCode でコーディングルールを 統一する【C#】