Skip to content

Commit fe86fd8

Browse files
authored
Merge pull request #4947 from MicrosoftDocs/master637200620108420312
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents e0b184a + a96099d commit fe86fd8

6 files changed

+127
-81
lines changed

docs/ide/editorconfig-code-style-settings-reference.md

Lines changed: 122 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: .NET coding convention settings For EditorConfig
3-
ms.date: 02/21/2020
3+
ms.date: 03/17/2020
44
ms.topic: reference
55
helpviewer_keywords:
66
- coding conventions [EditorConfig]
@@ -43,158 +43,204 @@ There are three supported .NET coding convention categories:
4343
To help you get started, here is an example *.editorconfig* file with the default options. In Visual Studio, you can generate this file and save it to a project at **Tools** > **Options** > **Text Editor** > [**C#** or **Basic**] > **Code Style** > **General**. Then, click the **Generate .editorconfig file from settings** button. For more information, see [Code style preferences](code-styles-and-code-cleanup.md).
4444

4545
```ini
46-
###############################
47-
# Core EditorConfig Options #
48-
###############################
49-
46+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
5047
root = true
5148

52-
# All files
53-
[*]
54-
indent_style = space
49+
# C# files
50+
[*.cs]
5551

56-
# Code files
57-
[*.{cs,csx,vb,vbx}]
52+
#### Core EditorConfig Options ####
53+
54+
# Indentation and spacing
5855
indent_size = 4
59-
insert_final_newline = true
60-
charset = utf-8-bom
56+
indent_style = space
57+
tab_width = 4
6158

62-
###############################
63-
# .NET Coding Conventions #
64-
###############################
59+
# New line preferences
60+
end_of_line = crlf
61+
insert_final_newline = false
6562

66-
[*.{cs,vb}]
63+
#### .NET Coding Conventions ####
6764

6865
# Organize usings
69-
dotnet_sort_system_directives_first = true
66+
dotnet_separate_import_directive_groups = false
67+
dotnet_sort_system_directives_first = false
7068

71-
# this. preferences
69+
# this. and Me. preferences
70+
dotnet_style_qualification_for_event = false:silent
7271
dotnet_style_qualification_for_field = false:silent
73-
dotnet_style_qualification_for_property = false:silent
7472
dotnet_style_qualification_for_method = false:silent
75-
dotnet_style_qualification_for_event = false:silent
73+
dotnet_style_qualification_for_property = false:silent
7674

7775
# Language keywords vs BCL types preferences
7876
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
7977
dotnet_style_predefined_type_for_member_access = true:silent
8078

8179
# Parentheses preferences
8280
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
83-
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
8481
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
8582
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
83+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
8684

8785
# Modifier preferences
8886
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
89-
dotnet_style_readonly_field = true:suggestion
9087

9188
# Expression-level preferences
92-
dotnet_style_object_initializer = true:suggestion
89+
dotnet_style_coalesce_expression = true:suggestion
9390
dotnet_style_collection_initializer = true:suggestion
9491
dotnet_style_explicit_tuple_names = true:suggestion
9592
dotnet_style_null_propagation = true:suggestion
96-
dotnet_style_coalesce_expression = true:suggestion
97-
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
98-
dotnet_style_prefer_inferred_tuple_names = true:suggestion
99-
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
93+
dotnet_style_object_initializer = true:suggestion
10094
dotnet_style_prefer_auto_properties = true:silent
95+
dotnet_style_prefer_compound_assignment = true:suggestion
10196
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
10297
dotnet_style_prefer_conditional_expression_over_return = true:silent
98+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
99+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
100+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
101+
dotnet_style_prefer_simplified_interpolation = true:suggestion
103102

104-
###############################
105-
# Naming Conventions #
106-
###############################
103+
# Field preferences
104+
dotnet_style_readonly_field = true:suggestion
107105

108-
# Style Definitions
109-
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
110-
# Use PascalCase for constant fields
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.applicable_accessibilities = *
116-
dotnet_naming_symbols.constant_fields.required_modifiers = const
106+
# Parameter preferences
107+
dotnet_code_quality_unused_parameters = all:suggestion
117108

118-
###############################
119-
# C# Coding Conventions #
120-
###############################
121-
122-
[*.cs]
109+
#### C# Coding Conventions ####
123110

124111
# var preferences
125-
csharp_style_var_for_built_in_types = true:silent
126-
csharp_style_var_when_type_is_apparent = true:silent
127-
csharp_style_var_elsewhere = true:silent
112+
csharp_style_var_elsewhere = false:silent
113+
csharp_style_var_for_built_in_types = false:silent
114+
csharp_style_var_when_type_is_apparent = false:silent
128115

129116
# Expression-bodied members
130-
csharp_style_expression_bodied_methods = false:silent
117+
csharp_style_expression_bodied_accessors = true:silent
131118
csharp_style_expression_bodied_constructors = false:silent
119+
csharp_style_expression_bodied_indexers = true:silent
120+
csharp_style_expression_bodied_lambdas = true:silent
121+
csharp_style_expression_bodied_local_functions = false:silent
122+
csharp_style_expression_bodied_methods = false:silent
132123
csharp_style_expression_bodied_operators = false:silent
133124
csharp_style_expression_bodied_properties = true:silent
134-
csharp_style_expression_bodied_indexers = true:silent
135-
csharp_style_expression_bodied_accessors = true:silent
136125

137126
# Pattern matching preferences
138-
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
139127
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
128+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
129+
csharp_style_prefer_switch_expression = true:suggestion
140130

141131
# Null-checking preferences
142-
csharp_style_throw_expression = true:suggestion
143132
csharp_style_conditional_delegate_call = true:suggestion
144133

145134
# Modifier preferences
146-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
135+
csharp_prefer_static_local_function = true:suggestion
136+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
147137

148-
# Expression-level preferences
138+
# Code-block preferences
149139
csharp_prefer_braces = true:silent
150-
csharp_style_deconstructed_variable_declaration = true:suggestion
140+
csharp_prefer_simple_using_statement = true:suggestion
141+
142+
# Expression-level preferences
151143
csharp_prefer_simple_default_expression = true:suggestion
152-
csharp_style_pattern_local_over_anonymous_function = true:suggestion
144+
csharp_style_deconstructed_variable_declaration = true:suggestion
153145
csharp_style_inlined_variable_declaration = true:suggestion
146+
csharp_style_pattern_local_over_anonymous_function = true:suggestion
147+
csharp_style_prefer_index_operator = true:suggestion
148+
csharp_style_prefer_range_operator = true:suggestion
149+
csharp_style_throw_expression = true:suggestion
150+
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
151+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
154152

155-
###############################
156-
# C# Formatting Rules #
157-
###############################
153+
# 'using' directive preferences
154+
csharp_using_directive_placement = outside_namespace:silent
155+
156+
#### C# Formatting Rules ####
158157

159158
# New line preferences
160-
csharp_new_line_before_open_brace = all
161-
csharp_new_line_before_else = true
162159
csharp_new_line_before_catch = true
160+
csharp_new_line_before_else = true
163161
csharp_new_line_before_finally = true
164-
csharp_new_line_before_members_in_object_initializers = true
165162
csharp_new_line_before_members_in_anonymous_types = true
163+
csharp_new_line_before_members_in_object_initializers = true
164+
csharp_new_line_before_open_brace = all
166165
csharp_new_line_between_query_expression_clauses = true
167166

168167
# Indentation preferences
168+
csharp_indent_block_contents = true
169+
csharp_indent_braces = false
169170
csharp_indent_case_contents = true
171+
csharp_indent_case_contents_when_block = true
172+
csharp_indent_labels = one_less_than_current
170173
csharp_indent_switch_labels = true
171-
csharp_indent_labels = flush_left
172174

173175
# Space preferences
174176
csharp_space_after_cast = false
177+
csharp_space_after_colon_in_inheritance_clause = true
178+
csharp_space_after_comma = true
179+
csharp_space_after_dot = false
175180
csharp_space_after_keywords_in_control_flow_statements = true
181+
csharp_space_after_semicolon_in_for_statement = true
182+
csharp_space_around_binary_operators = before_and_after
183+
csharp_space_around_declaration_statements = false
184+
csharp_space_before_colon_in_inheritance_clause = true
185+
csharp_space_before_comma = false
186+
csharp_space_before_dot = false
187+
csharp_space_before_open_square_brackets = false
188+
csharp_space_before_semicolon_in_for_statement = false
189+
csharp_space_between_empty_square_brackets = false
190+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
191+
csharp_space_between_method_call_name_and_opening_parenthesis = false
176192
csharp_space_between_method_call_parameter_list_parentheses = false
193+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
194+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
177195
csharp_space_between_method_declaration_parameter_list_parentheses = false
178196
csharp_space_between_parentheses = false
179-
csharp_space_before_colon_in_inheritance_clause = true
180-
csharp_space_after_colon_in_inheritance_clause = true
181-
csharp_space_around_binary_operators = before_and_after
182-
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
183-
csharp_space_between_method_call_name_and_opening_parenthesis = false
184-
csharp_space_between_method_call_empty_parameter_list_parentheses = false
197+
csharp_space_between_square_brackets = false
185198

186199
# Wrapping preferences
187-
csharp_preserve_single_line_statements = true
188200
csharp_preserve_single_line_blocks = true
201+
csharp_preserve_single_line_statements = true
189202

190-
###############################
191-
# VB Coding Conventions #
192-
###############################
203+
#### Naming styles ####
193204

194-
[*.vb]
205+
# Naming rules
195206

196-
# Modifier preferences
197-
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
207+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
208+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
209+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
210+
211+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
212+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
213+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
214+
215+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
216+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
217+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
218+
219+
# Symbol specifications
220+
221+
dotnet_naming_symbols.interface.applicable_kinds = interface
222+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
223+
dotnet_naming_symbols.interface.required_modifiers =
224+
225+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
226+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
227+
dotnet_naming_symbols.types.required_modifiers =
228+
229+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
230+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
231+
dotnet_naming_symbols.non_field_members.required_modifiers =
232+
233+
# Naming styles
234+
235+
dotnet_naming_style.pascal_case.required_prefix =
236+
dotnet_naming_style.pascal_case.required_suffix =
237+
dotnet_naming_style.pascal_case.word_separator =
238+
dotnet_naming_style.pascal_case.capitalization = pascal_case
239+
240+
dotnet_naming_style.begins_with_i.required_prefix = I
241+
dotnet_naming_style.begins_with_i.required_suffix =
242+
dotnet_naming_style.begins_with_i.word_separator =
243+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
198244
```
199245

200246
## See also

docs/install/workload-and-component-ids.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
author: ornellaalt
77
ms.author: ornella
88
manager: jillfra
9-
ms.date: 12/03/2019
9+
ms.date: 03/16/2020
1010
ms.topic: reference
1111
helpviewer_keywords:
1212
- workload ID, Visual Studio

docs/install/workload-component-id-vs-team-explorer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
author: ornellaalt
77
ms.author: ornella
88
manager: jillfra
9-
ms.date: 12/03/2019
9+
ms.date: 03/16/2020
1010
ms.topic: reference
1111
helpviewer_keywords:
1212
- workload ID, Visual Studio

docs/install/workload-component-id-vs-test-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
author: ornellaalt
77
ms.author: ornella
88
manager: jillfra
9-
ms.date: 12/03/2019
9+
ms.date: 03/16/2020
1010
ms.topic: reference
1111
helpviewer_keywords:
1212
- workload ID, Visual Studio

docs/install/workload-component-id-vs-test-controller.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
author: ornellaalt
77
ms.author: ornella
88
manager: jillfra
9-
ms.date: 12/03/2019
9+
ms.date: 03/16/2020
1010
ms.topic: reference
1111
helpviewer_keywords:
1212
- workload ID, Visual Studio

docs/install/workload-component-id-vs-test-professional.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Use Visual Studio workload and component IDs to provide integrated
55
author: ornellaalt
66
ms.author: ornella
77
manager: jillfra
8-
ms.date: 09/23/2019
8+
ms.date: 03/16/2020
99
ms.topic: reference
1010
helpviewer_keywords:
1111
- workload ID, Visual Studio

0 commit comments

Comments
 (0)