1
+ # EditorConfig for Visual Studio 2022: https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2022
2
+
3
+ # This is a top-most .editorconfig file
4
+ root = true
5
+
6
+ # =====================================================
7
+ #
8
+ # nanoFramework specific settings
9
+ #
10
+ #
11
+ # =====================================================
12
+ [* ]
13
+ # Generic EditorConfig settings
14
+ end_of_line = crlf
15
+ charset = utf-8-bom
16
+
17
+ # Visual Studio spell checker
18
+ spelling_languages = en-us
19
+ spelling_checkable_types = strings,identifiers,comments
20
+ spelling_error_severity = information
21
+ spelling_exclusion_path = spelling_exclusion.dic
22
+
23
+ # =====================================================
24
+ #
25
+ # Settings copied from the .NET runtime
26
+ #
27
+ # https://github.com/dotnet/runtime
28
+ #
29
+ # =====================================================
30
+ # Default settings:
31
+ # A newline ending every file
32
+ # Use 4 spaces as indentation
33
+ insert_final_newline = true
34
+ indent_style = space
35
+ indent_size = 4
36
+ trim_trailing_whitespace = true
37
+
38
+ # Generated code
39
+ [* {_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs} ]
40
+ generated_code = true
41
+ dotnet_style_coalesce_expression = true :suggestion
42
+ dotnet_style_null_propagation = true :suggestion
43
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
44
+ dotnet_style_prefer_auto_properties = true :suggestion
45
+ dotnet_style_object_initializer = true :suggestion
46
+ dotnet_style_collection_initializer = true :suggestion
47
+ dotnet_style_prefer_simplified_boolean_expressions = true :suggestion
48
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
49
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
50
+ dotnet_style_explicit_tuple_names = true :suggestion
51
+ dotnet_style_operator_placement_when_wrapping = beginning_of_line
52
+ tab_width = 4
53
+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
54
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
55
+ dotnet_style_prefer_compound_assignment = true :suggestion
56
+ dotnet_style_prefer_simplified_interpolation = true :suggestion
57
+ dotnet_style_prefer_collection_expression = when_types_exactly_match:suggestion
58
+ dotnet_style_namespace_match_folder = true :suggestion
59
+ dotnet_style_readonly_field = true :suggestion
60
+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
61
+ dotnet_style_predefined_type_for_member_access = true :suggestion
62
+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
63
+ dotnet_style_allow_multiple_blank_lines_experimental = true :silent
64
+ dotnet_style_allow_statement_immediately_after_block_experimental = true :silent
65
+ dotnet_code_quality_unused_parameters = all:suggestion
66
+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
67
+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
68
+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
69
+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
70
+ dotnet_style_qualification_for_field = false :suggestion
71
+ dotnet_style_qualification_for_property = false :suggestion
72
+ dotnet_style_qualification_for_method = false :suggestion
73
+ dotnet_style_qualification_for_event = false :suggestion
74
+
75
+ # C# files
76
+ [* .cs ]
77
+ # New line preferences
78
+ csharp_new_line_before_open_brace = all
79
+ csharp_new_line_before_else = true
80
+ csharp_new_line_before_catch = true
81
+ csharp_new_line_before_finally = true
82
+ csharp_new_line_before_members_in_object_initializers = true
83
+ csharp_new_line_before_members_in_anonymous_types = true
84
+ csharp_new_line_between_query_expression_clauses = true
85
+
86
+ # Indentation preferences
87
+ csharp_indent_block_contents = true
88
+ csharp_indent_braces = false
89
+ csharp_indent_case_contents = true
90
+ csharp_indent_case_contents_when_block = false
91
+ csharp_indent_switch_labels = true
92
+ csharp_indent_labels = one_less_than_current
93
+
94
+ # Modifier preferences
95
+ csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
96
+
97
+ # avoid this. unless absolutely necessary
98
+ dotnet_style_qualification_for_field = false :suggestion
99
+ dotnet_style_qualification_for_property = false :suggestion
100
+ dotnet_style_qualification_for_method = false :suggestion
101
+ dotnet_style_qualification_for_event = false :suggestion
102
+
103
+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
104
+ csharp_style_var_for_built_in_types = false :suggestion
105
+ csharp_style_var_when_type_is_apparent = false :none
106
+ csharp_style_var_elsewhere = false :suggestion
107
+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
108
+ dotnet_style_predefined_type_for_member_access = true :suggestion
109
+
110
+ # name all constant fields using PascalCase
111
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
112
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
113
+ dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
114
+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
115
+ dotnet_naming_symbols.constant_fields.required_modifiers = const
116
+ dotnet_naming_style.pascal_case_style.capitalization = pascal_case
117
+
118
+ # static fields should have _ prefix
119
+ dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
120
+ dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
121
+ dotnet_naming_rule.static_fields_should_have_prefix.style = camel_case_underscore_style
122
+ dotnet_naming_symbols.static_fields.applicable_kinds = field
123
+ dotnet_naming_symbols.static_fields.required_modifiers = static
124
+ dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
125
+ dotnet_naming_style.static_prefix_style.required_prefix = _
126
+ dotnet_naming_style.static_prefix_style.capitalization = camel_case
127
+
128
+ # internal and private fields should be _camelCase
129
+ dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
130
+ dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
131
+ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
132
+ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
133
+ dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
134
+ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
135
+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
136
+
137
+ # Code style defaults
138
+ csharp_using_directive_placement = outside_namespace:suggestion
139
+ dotnet_sort_system_directives_first = true
140
+ csharp_prefer_braces = true :silent
141
+ csharp_preserve_single_line_blocks = true :none
142
+ csharp_preserve_single_line_statements = false :none
143
+ csharp_prefer_static_local_function = true :suggestion
144
+ csharp_prefer_simple_using_statement = false :none
145
+ csharp_style_prefer_switch_expression = true :suggestion
146
+ dotnet_style_readonly_field = true :suggestion
147
+
148
+ # Expression-level preferences
149
+ dotnet_style_object_initializer = true :suggestion
150
+ dotnet_style_collection_initializer = true :suggestion
151
+ dotnet_style_prefer_collection_expression = when_types_exactly_match
152
+ dotnet_style_explicit_tuple_names = true :suggestion
153
+ dotnet_style_coalesce_expression = true :suggestion
154
+ dotnet_style_null_propagation = true :suggestion
155
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
156
+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
157
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
158
+ dotnet_style_prefer_auto_properties = true :suggestion
159
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
160
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
161
+ csharp_prefer_simple_default_expression = true :suggestion
162
+
163
+ # Expression-bodied members
164
+ csharp_style_expression_bodied_methods = true :silent
165
+ csharp_style_expression_bodied_constructors = true :silent
166
+ csharp_style_expression_bodied_operators = true :silent
167
+ csharp_style_expression_bodied_properties = true :silent
168
+ csharp_style_expression_bodied_indexers = true :silent
169
+ csharp_style_expression_bodied_accessors = true :silent
170
+ csharp_style_expression_bodied_lambdas = true :silent
171
+ csharp_style_expression_bodied_local_functions = true :silent
172
+
173
+ # Pattern matching
174
+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
175
+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
176
+ csharp_style_inlined_variable_declaration = true :suggestion
177
+
178
+ # Null checking preferences
179
+ csharp_style_throw_expression = true :suggestion
180
+ csharp_style_conditional_delegate_call = true :suggestion
181
+
182
+ # Other features
183
+ csharp_style_prefer_index_operator = false :none
184
+ csharp_style_prefer_range_operator = false :none
185
+ csharp_style_pattern_local_over_anonymous_function = false :none
186
+
187
+ # Space preferences
188
+ csharp_space_after_cast = false
189
+ csharp_space_after_colon_in_inheritance_clause = true
190
+ csharp_space_after_comma = true
191
+ csharp_space_after_dot = false
192
+ csharp_space_after_keywords_in_control_flow_statements = true
193
+ csharp_space_after_semicolon_in_for_statement = true
194
+ csharp_space_around_binary_operators = before_and_after
195
+ csharp_space_around_declaration_statements = do_not_ignore
196
+ csharp_space_before_colon_in_inheritance_clause = true
197
+ csharp_space_before_comma = false
198
+ csharp_space_before_dot = false
199
+ csharp_space_before_open_square_brackets = false
200
+ csharp_space_before_semicolon_in_for_statement = false
201
+ csharp_space_between_empty_square_brackets = false
202
+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
203
+ csharp_space_between_method_call_name_and_opening_parenthesis = false
204
+ csharp_space_between_method_call_parameter_list_parentheses = false
205
+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
206
+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
207
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
208
+ csharp_space_between_parentheses = false
209
+ csharp_space_between_square_brackets = false
210
+
211
+ # License header
212
+ file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.
213
+ csharp_style_namespace_declarations = block_scoped:silent
214
+ csharp_style_prefer_method_group_conversion = true :silent
215
+ csharp_style_prefer_top_level_statements = true :silent
216
+ csharp_style_prefer_primary_constructors = true :suggestion
217
+ csharp_prefer_system_threading_lock = true :suggestion
218
+ csharp_style_prefer_null_check_over_type_check = true :suggestion
219
+ csharp_style_prefer_local_over_anonymous_function = true :suggestion
220
+ csharp_style_implicit_object_creation_when_type_is_apparent = true :suggestion
221
+ csharp_style_prefer_tuple_swap = true :suggestion
222
+ csharp_style_prefer_utf8_string_literals = true :suggestion
223
+ csharp_style_deconstructed_variable_declaration = true :suggestion
224
+ csharp_style_unused_value_assignment_preference = discard_variable:suggestion
225
+ csharp_style_unused_value_expression_statement_preference = discard_variable:silent
226
+ csharp_prefer_static_anonymous_function = true :suggestion
227
+ csharp_style_prefer_readonly_struct = true :suggestion
228
+ csharp_style_prefer_readonly_struct_member = true :suggestion
229
+ csharp_style_allow_embedded_statements_on_same_line_experimental = true :silent
230
+ csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true :silent
231
+ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true :silent
232
+ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true :silent
233
+ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true :silent
234
+ csharp_style_prefer_pattern_matching = true :silent
235
+ csharp_style_prefer_extended_property_pattern = true :suggestion
236
+ csharp_style_prefer_not_pattern = true :suggestion
237
+
238
+ # C++ Files
239
+ [* .{cpp,h,in} ]
240
+ curly_bracket_next_line = true
241
+ indent_brace_style = Allman
242
+
243
+ # Xml project files
244
+ [* .{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj} ]
245
+ indent_size = 2
246
+
247
+ [* .{csproj,vbproj,proj,nativeproj,locproj} ]
248
+ charset = utf-8
249
+
250
+ # Xml build files
251
+ [* .builds ]
252
+ indent_size = 2
253
+
254
+ # Xml files
255
+ [* .{xml,stylecop,resx,ruleset} ]
256
+ indent_size = 2
257
+
258
+ # Xml config files
259
+ [* .{props,targets,config,nuspec} ]
260
+ indent_size = 2
261
+
262
+ # YAML config files
263
+ [* .{yml,yaml} ]
264
+ indent_size = 2
265
+
266
+ # Shell scripts
267
+ [* .sh ]
268
+ end_of_line = lf
269
+ [* .{cmd,bat} ]
270
+ end_of_line = crlf
0 commit comments