1- # C# files
2- [* .cs ]
3-
4- # ### Core EditorConfig Options ####
1+ # editorconfig.org
52
6- # New line preferences
3+ # Default settings:
4+ # A newline ending every file
5+ # Use 4 spaces as indentation
6+ [* ]
77insert_final_newline = true
8+ indent_style = space
9+ indent_size = 4
810trim_trailing_whitespace = true
911
10- # ### .NET Code Actions ####
12+ # Generated code
13+ [* {_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs} ]
14+ generated_code = true
1115
12- # Type members
13- dotnet_hide_advanced_members = false
14- dotnet_member_insertion_location = with_other_members_of_the_same_kind
15- dotnet_property_generation_behavior = prefer_throwing_properties
16-
17- # Symbol search
18- dotnet_search_reference_assemblies = true
16+ # C# files
17+ [* .cs ]
18+ # New line preferences
19+ csharp_new_line_before_open_brace = all
20+ csharp_new_line_before_else = true
21+ csharp_new_line_before_catch = true
22+ csharp_new_line_before_finally = true
23+ csharp_new_line_before_members_in_object_initializers = true
24+ csharp_new_line_before_members_in_anonymous_types = true
25+ csharp_new_line_between_query_expression_clauses = true
1926
20- # ### .NET Coding Conventions ####
27+ # Indentation preferences
28+ csharp_indent_block_contents = true
29+ csharp_indent_braces = false
30+ csharp_indent_case_contents = true
31+ csharp_indent_case_contents_when_block = false
32+ csharp_indent_switch_labels = true
33+ csharp_indent_labels = one_less_than_current
2134
22- # Organize usings
23- dotnet_separate_import_directive_groups = false
24- dotnet_sort_system_directives_first = false
25- file_header_template = unset
35+ # Modifier preferences
36+ csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
2637
27- # this. and Me. preferences
2838dotnet_style_qualification_for_event = true
2939dotnet_style_qualification_for_field = true
3040dotnet_style_qualification_for_method = true
3141dotnet_style_qualification_for_property = true
3242
33- # Language keywords vs BCL types preferences
34- dotnet_style_predefined_type_for_locals_parameters_members = true
35- dotnet_style_predefined_type_for_member_access = true
36-
37- # Parentheses preferences
38- dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
39- dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
40- dotnet_style_parentheses_in_other_operators = never_if_unnecessary
41- dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
42-
43- # Modifier preferences
44- dotnet_style_require_accessibility_modifiers = for_non_interface_members
43+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
44+ csharp_style_var_for_built_in_types = false :suggestion
45+ csharp_style_var_when_type_is_apparent = false :none
46+ csharp_style_var_elsewhere = false :suggestion
47+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
48+ dotnet_style_predefined_type_for_member_access = true :suggestion
49+
50+ # name all constant fields using PascalCase
51+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
52+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
53+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
54+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
55+ dotnet_naming_symbols.constant_fields.required_modifiers = const
56+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
57+
58+ # static fields should have s_ prefix
59+ dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
60+ dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
61+ dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
62+ dotnet_naming_symbols.static_fields.applicable_kinds = field
63+ dotnet_naming_symbols.static_fields.required_modifiers = static
64+ dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
65+ dotnet_naming_style.static_prefix_style.required_prefix = s_
66+ dotnet_naming_style.static_prefix_style.capitalization = camel_case
67+
68+ # internal and private fields should be _camelCase
69+ dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
70+ dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
71+ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
72+ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
73+ dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
74+ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
75+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
76+
77+ # Code style defaults
78+ csharp_using_directive_placement = outside_namespace:suggestion
79+ dotnet_sort_system_directives_first = true
80+ csharp_prefer_braces = true :silent
81+ csharp_preserve_single_line_blocks = true :none
82+ csharp_preserve_single_line_statements = false :none
83+ csharp_prefer_static_local_function = true :suggestion
84+ csharp_prefer_simple_using_statement = false :none
85+ csharp_style_prefer_switch_expression = true :suggestion
86+ dotnet_style_readonly_field = true :suggestion
4587
4688# Expression-level preferences
47- dotnet_prefer_system_hash_code = true
48- dotnet_style_coalesce_expression = true
49- dotnet_style_collection_initializer = true
50- dotnet_style_explicit_tuple_names = true
51- dotnet_style_namespace_match_folder = true
52- dotnet_style_null_propagation = true
53- dotnet_style_object_initializer = true
54- dotnet_style_operator_placement_when_wrapping = beginning_of_line
55- dotnet_style_prefer_auto_properties = true
56- dotnet_style_prefer_collection_expression = when_types_loosely_match
57- dotnet_style_prefer_compound_assignment = true
58- dotnet_style_prefer_conditional_expression_over_assignment = true
59- dotnet_style_prefer_conditional_expression_over_return = true
60- dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
61- dotnet_style_prefer_inferred_anonymous_type_member_names = true
62- dotnet_style_prefer_inferred_tuple_names = true
63- dotnet_style_prefer_is_null_check_over_reference_equality_method = true
64- dotnet_style_prefer_simplified_boolean_expressions = true
65- dotnet_style_prefer_simplified_interpolation = true
66-
67- # Field preferences
68- dotnet_style_readonly_field = true
69-
70- # Parameter preferences
71- dotnet_code_quality_unused_parameters = all
72-
73- # Suppression preferences
74- dotnet_remove_unnecessary_suppression_exclusions = none
75-
76- # New line preferences
77- dotnet_style_allow_multiple_blank_lines_experimental = true
78- dotnet_style_allow_statement_immediately_after_block_experimental = true
79-
80- # ### C# Coding Conventions ####
81-
82- # var preferences
83- csharp_style_var_elsewhere = false
84- csharp_style_var_for_built_in_types = false
85- csharp_style_var_when_type_is_apparent = false
89+ dotnet_style_object_initializer = true :suggestion
90+ dotnet_style_collection_initializer = true :suggestion
91+ dotnet_style_prefer_collection_expression = when_types_exactly_match
92+ dotnet_style_explicit_tuple_names = true :suggestion
93+ dotnet_style_coalesce_expression = true :suggestion
94+ dotnet_style_null_propagation = true :suggestion
95+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
96+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
97+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
98+ dotnet_style_prefer_auto_properties = true :suggestion
99+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
100+ dotnet_style_prefer_conditional_expression_over_return = true :silent
101+ csharp_prefer_simple_default_expression = true :suggestion
86102
87103# Expression-bodied members
88- csharp_style_expression_bodied_accessors = true :silent
89- csharp_style_expression_bodied_constructors = false :silent
104+ csharp_style_expression_bodied_methods = true :silent
105+ csharp_style_expression_bodied_constructors = true :silent
106+ csharp_style_expression_bodied_operators = true :silent
107+ csharp_style_expression_bodied_properties = true :silent
90108csharp_style_expression_bodied_indexers = true :silent
109+ csharp_style_expression_bodied_accessors = true :silent
91110csharp_style_expression_bodied_lambdas = true :silent
92- csharp_style_expression_bodied_local_functions = false :silent
93- csharp_style_expression_bodied_methods = false :silent
94- csharp_style_expression_bodied_operators = false :silent
95- csharp_style_expression_bodied_properties = true :silent
96-
97- # Pattern matching preferences
98- csharp_style_pattern_matching_over_as_with_null_check = true
99- csharp_style_pattern_matching_over_is_with_cast_check = true
100- csharp_style_prefer_extended_property_pattern = true
101- csharp_style_prefer_not_pattern = true
102- csharp_style_prefer_pattern_matching = true
103- csharp_style_prefer_switch_expression = true
104-
105- # Null-checking preferences
106- csharp_style_conditional_delegate_call = true
107-
108- # Modifier preferences
109- csharp_prefer_static_anonymous_function = true
110- csharp_prefer_static_local_function = true
111- csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
112- csharp_style_prefer_readonly_struct = true
113- csharp_style_prefer_readonly_struct_member = true
114-
115- # Code-block preferences
116- csharp_prefer_braces = true :silent
117- csharp_prefer_simple_using_statement = true :suggestion
118- csharp_prefer_system_threading_lock = true :suggestion
119- csharp_style_namespace_declarations = block_scoped:silent
120- csharp_style_prefer_method_group_conversion = true :silent
121- csharp_style_prefer_primary_constructors = false :suggestion
122- csharp_style_prefer_top_level_statements = true :silent
123-
124- # Expression-level preferences
125- csharp_prefer_simple_default_expression = true
126- csharp_style_deconstructed_variable_declaration = true
127- csharp_style_implicit_object_creation_when_type_is_apparent = false :silent
128- csharp_style_inlined_variable_declaration = true
129- csharp_style_prefer_index_operator = true
130- csharp_style_prefer_local_over_anonymous_function = true
131- csharp_style_prefer_null_check_over_type_check = true
132- csharp_style_prefer_range_operator = true
133- csharp_style_prefer_tuple_swap = true
134- csharp_style_prefer_utf8_string_literals = true
135- csharp_style_throw_expression = true
136- csharp_style_unused_value_assignment_preference = discard_variable
137- csharp_style_unused_value_expression_statement_preference = discard_variable
138-
139- # 'using' directive preferences
140- csharp_using_directive_placement = outside_namespace:silent
141-
142- # New line preferences
143- csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
144- csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
145- csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
146- csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
147- csharp_style_allow_embedded_statements_on_same_line_experimental = true
111+ csharp_style_expression_bodied_local_functions = true :silent
148112
149- # ### C# Formatting Rules ####
113+ # Pattern matching
114+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
115+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
116+ csharp_style_inlined_variable_declaration = true :suggestion
150117
151- # New line preferences
152- csharp_new_line_before_catch = true
153- csharp_new_line_before_else = true
154- csharp_new_line_before_finally = true
155- csharp_new_line_before_members_in_anonymous_types = true
156- csharp_new_line_before_members_in_object_initializers = true
157- csharp_new_line_before_open_brace = all
158- csharp_new_line_between_query_expression_clauses = true
118+ # Null checking preferences
119+ csharp_style_throw_expression = true :suggestion
120+ csharp_style_conditional_delegate_call = true :suggestion
159121
160- # Indentation preferences
161- csharp_indent_block_contents = true
162- csharp_indent_braces = false
163- csharp_indent_case_contents = true
164- csharp_indent_case_contents_when_block = true
165- csharp_indent_labels = one_less_than_current
166- csharp_indent_switch_labels = true
122+ # Other features
123+ csharp_style_prefer_index_operator = false :none
124+ csharp_style_prefer_range_operator = false :none
125+ csharp_style_pattern_local_over_anonymous_function = false :none
167126
168127# Space preferences
169128csharp_space_after_cast = false
@@ -173,7 +132,7 @@ csharp_space_after_dot = false
173132csharp_space_after_keywords_in_control_flow_statements = true
174133csharp_space_after_semicolon_in_for_statement = true
175134csharp_space_around_binary_operators = before_and_after
176- csharp_space_around_declaration_statements = false
135+ csharp_space_around_declaration_statements = do_not_ignore
177136csharp_space_before_colon_in_inheritance_clause = true
178137csharp_space_before_comma = false
179138csharp_space_before_dot = false
@@ -189,57 +148,36 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
189148csharp_space_between_parentheses = false
190149csharp_space_between_square_brackets = false
191150
192- # Wrapping preferences
193- csharp_preserve_single_line_blocks = true
194- csharp_preserve_single_line_statements = true
195-
196- # ### Naming styles ####
151+ # C++ Files
152+ [* .{cpp,h,in} ]
153+ curly_bracket_next_line = true
154+ indent_brace_style = Allman
197155
198- # Naming rules
156+ # Xml project files
157+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj} ]
158+ indent_size = 2
199159
200- dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
201- dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
202- dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
160+ [* .{csproj,vbproj,proj,nativeproj,locproj} ]
161+ charset = utf-8
203162
204- dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
205- dotnet_naming_rule.types_should_be_pascal_case.symbols = types
206- dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
163+ # Xml build files
164+ [ * .builds ]
165+ indent_size = 2
207166
208- dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
209- dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
210- dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
167+ # Xml files
168+ [ * .{xml,stylecop,resx,ruleset} ]
169+ indent_size = 2
211170
212- # Symbol specifications
171+ # Xml config files
172+ [* .{props,targets,config,nuspec} ]
173+ indent_size = 2
213174
214- dotnet_naming_symbols.interface.applicable_kinds = interface
215- dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
216- dotnet_naming_symbols.interface.required_modifiers =
175+ # YAML config files
176+ [ * .{yml,yaml} ]
177+ indent_size = 2
217178
218- dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
219- dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
220- dotnet_naming_symbols.types.required_modifiers =
221-
222- dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
223- dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
224- dotnet_naming_symbols.non_field_members.required_modifiers =
225-
226- # Naming styles
227-
228- dotnet_naming_style.pascal_case.required_prefix =
229- dotnet_naming_style.pascal_case.required_suffix =
230- dotnet_naming_style.pascal_case.word_separator =
231- dotnet_naming_style.pascal_case.capitalization = pascal_case
232-
233- dotnet_naming_style.begins_with_i.required_prefix = I
234- dotnet_naming_style.begins_with_i.required_suffix =
235- dotnet_naming_style.begins_with_i.word_separator =
236- dotnet_naming_style.begins_with_i.capitalization = pascal_case
237-
238- [* .{cs,vb} ]
239- dotnet_style_coalesce_expression = true :suggestion
240- dotnet_style_null_propagation = true :suggestion
241- dotnet_style_operator_placement_when_wrapping = beginning_of_line
242- tab_width = 4
243- indent_size = 4
179+ # Shell scripts
180+ [* .sh ]
181+ end_of_line = lf
182+ [* .{cmd,bat} ]
244183end_of_line = crlf
245- dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
0 commit comments