Configure C# code style with EditorConfig
What is EditorConfig and how does JetBrains Fleet extend it?
EditorConfig is a configuration file convention that is used to define and maintain consistent code styles between team members working on the same code as well as between different editors and IDEs that they might use. The styles are saved in INI-like files named .editorconfig, where section names are file masks, and properties inside a section define code styles for files matching those masks.
As EditorConfig convention suggests, JetBrains Fleet will apply code styles defined in files named .editorconfig in the directory of the current file and in all its parent directories until it reaches the root filepath or finds an EditorConfig file with
root=true. File masks specified in .editorconfig files, for example
*Test.cs are also taken into account.
JetBrains Fleet understands standard EditorConfig properties, most frequently used .NET-coding-convention EditorConfig properties, and provides a set of custom EditorConfig properties, which allow for much more granular configuration of formatting, syntax, and code inspection rules . Below is an example of EditorConfig properties supported by JetBrains Fleet:
Disable JetBrains Fleet formatter with EditorConfig
In C#, you can disable the JetBrains Fleet formatter using EditorConfig masks that have
Standard EditorConfig properties
JetBrains Fleet will apply the following standard EditorConfig properties:
Note that among JetBrains Fleet's custom EditorConfig properties, there are properties that will override the standard properties for specific languages. For example, you can set a default indent size for all languages with
indent_size property, and at the same set a different indent size for C# files with csharp_indent_size property.
Custom EditorConfig properties
Custom EditorConfig properties that JetBrains Fleet provides, allow configuring code style and code inspection settings. Properties for code inspections can be found in the List of code inspections in C#. Properties for code style and formatting settings are listed in the child pages of the Reformat C# code topic.
.NET-coding-convention EditorConfig properties
As of version 1.8, JetBrains Fleet supports most frequently used EditorConfig properties for the .NET coding conventions:
dotnet_diagnostic.*— supported for all compiler warnings.
dotnet_naming_symbols.*— will work if the specified kinds of symbols can be matched by kinds of symbols available in JetBrains Fleet naming settings.