Skip to content

Commit d91777f

Browse files
author
Kasey Uhlenhuth
committed
15.7 only changes
1 parent 968509c commit d91777f

File tree

1 file changed

+20
-230
lines changed

1 file changed

+20
-230
lines changed

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

Lines changed: 20 additions & 230 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ The following table lists the possible severity values and their effects:
5151

5252
Severity | Effect
5353
:------- | ------
54-
`none` | Do not show anything to the user when this rule is violated. Code generation features will generate code in this style, however. Rules with `none` severity will never participate in **Format Document** cleanup or appear in the *Quick Actions and Refactorings* menu. In most cases, this is considered "disabled" or "ignored".
55-
`silent` (also `refactoring` in version 15.8) | Do not show anything to the user when this rule is violated. Code generation features will generate code in this style, however. Rules with `silent` severity will participate in cleanup if enabled in the **Format Document** settings and the *Quick Actions and Refactorings* menu.
54+
`none` or `silent` | Do not show anything to the user when this rule is violated. Code generation features will generate code in this style, however. If enabled in the **Format Document** settings, rules with `none` severity appear in the *Quick Actions and Refactorings* menu. In most cases, this is considered "disabled" or "ignored".
5655
`suggestion` | When this style rule is violated, show it to the user as a suggestion. Suggestions appear as three gray dots under the first two characters.
5756
`warning` | When this style rule is violated, show a compiler warning.
5857
`error` | When this style rule is violated, show a compiler error.
@@ -73,20 +72,13 @@ The following list shows the allowable language convention rules:
7372
- csharp\_preferred\_modifier_order
7473
- visual\_basic\_preferred\_modifier_order
7574
- dotnet\_style\_readonly\_field
76-
- [Parentheses preferences](#parentheses)
77-
- dotnet\_style\_parentheses\_in\_arithmetic\_binary\_operators
78-
- dotnet\_style\_parentheses\_in\_other\_binary\_operators
79-
- dotnet\_style\_parentheses\_in\_other\_operators
80-
- dotnet\_style\_parentheses\_in\_relational\_binary\_operators
8175
- [Expression-level preferences](#expression_level)
8276
- dotnet\_style\_object_initializer
8377
- dotnet\_style\_collection_initializer
8478
- dotnet\_style\_explicit\_tuple_names
8579
- dotnet\_prefer\_inferred\_tuple_names
8680
- dotnet\_prefer\_inferred\_anonymous\_type\_member_names
8781
- dotnet\_style\_prefer\_auto\_properties
88-
- dotnet\_style\_prefer\_conditional\_expression\_over\_assignment
89-
- dotnet\_style\_prefer\_conditional\_expression\_over\_return
9082
- dotnet\_style\_prefer\_is\_null\_check\_over\_reference\_equality\_method
9183
- ["Null" checking preferences](#null_checking)
9284
- dotnet\_style\_coalesce_expression
@@ -412,125 +404,6 @@ csharp_preferred_modifier_order = public,private,protected,internal,static,exter
412404
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
413405
```
414406

415-
#### <a name="parentheses"></a>Parentheses preferences
416-
417-
The style rules in this section concern parentheses preferences, including the use of parentheses for arithmetic, relational, and other binary operators.
418-
419-
The following table shows the rule names, rule IDs, applicable programming languages, default values, and first supported version of Visual Studio:
420-
421-
| Rule name | Rule ID | Applicable languages | Visual Studio default | Visual Studio 2017 version |
422-
| --------- | ------- | -------------------- | ----------------------| ---- |
423-
| dotnet_style_parentheses_in_arithmetic_binary_operators | IDE0047 | C# and Visual Basic | always_for_clarity:none | 15.8 |
424-
| dotnet_style_parentheses_in_relational_binary_operators | IDE0047 | C# and Visual Basic | always_for_clarity:none | 15.8 |
425-
| dotnet_style_parentheses_in_other_binary_operators | IDE0047 | C# and Visual Basic | always_for_clarity:none | 15.8 |
426-
| dotnet_style_parentheses_in_other_operators | IDE0047 | C# and Visual Basic | never_if_unnecessary:none | 15.8 |
427-
428-
**dotnet\_style\_parentheses\_in\_arithmetic\_binary_operators**
429-
430-
- When this rule is set to **always_for_clarity**, prefer parentheses to clarify arithmetic operator (`*`, `/`, `%`, `+`, `-`, `<<`, `>>`, `&`, `^`, `|`) precedence.
431-
- When this rule is set to **never_if_unnecessary**, prefer to not have parentheses when arithmetic operator (`*`, `/`, `%`, `+`, `-`, `<<`, `>>`, `&`, `^`, `|`) precedence is obvious.
432-
433-
Code examples:
434-
435-
```csharp
436-
// dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
437-
var v = a + (b * c);
438-
439-
// dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
440-
var v = a + b * c;
441-
442-
```
443-
444-
```vb
445-
' dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
446-
Dim v = a + (b * c)
447-
448-
' dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
449-
Dim v = a + b * c
450-
451-
```
452-
453-
**dotnet\_style\_parentheses\_in\_relational\_binary_operators**
454-
455-
- When this rule is set to **always_for_clarity**, prefer parentheses to clarify relational operator (`>`, `<`, `<=`, `>=`, `is`, `as`, `==`, `!=`) precedence .
456-
- When this rule is set to **never_if_unnecessary**, prefer to not have parentheses when relational operator (`>`, `<`, `<=`, `>=`, `is`, `as`, `==`, `!=`) precedence is obvious.
457-
458-
Code examples:
459-
460-
```csharp
461-
// dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
462-
var v = (a < b) == (c > d);
463-
464-
// dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
465-
var v = a < b == c > d;
466-
467-
```
468-
469-
```vb
470-
' dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
471-
Dim v = (a < b) = (c > d)
472-
473-
' dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
474-
Dim v = a < b = c > d
475-
```
476-
477-
**dotnet\_style\_parentheses\_in\_other\_binary_operators**
478-
479-
- When this rule is set to **always_for_clarity**, prefer parentheses to clarify other binary operator (`&&`, `||`, `??`) precedence.
480-
- When this rule is set to **never_if_unnecessary**, prefer to not have parentheses when other binary operator (`&&`, `||`, `??`) precedence is obvious.
481-
482-
Code examples:
483-
484-
```csharp
485-
// dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
486-
var v = a || (b && c);
487-
488-
// dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
489-
var v = a || b && c;
490-
```
491-
492-
```vb
493-
' dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
494-
Dim v = a OrElse (b AndAlso c)
495-
496-
' dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
497-
Dim v = a OrElse b AndAlso c
498-
```
499-
500-
**dotnet\_style\_parentheses\_in\_other_operators**
501-
502-
- When this rule is set to **always_for_clarity**, prefer parentheses to clarify operator precedence.
503-
- When this rule is set to **never_if_unnecessary**, prefer to not have parentheses when operator precedence is obvious.
504-
505-
Code examples:
506-
507-
```csharp
508-
// dotnet_style_parentheses_in_other_operators = always_for_clarity
509-
var v = (a.b).Length;
510-
511-
// dotnet_style_parentheses_in_other_operators = never_if_unnecessary
512-
var v = a.b.Length;
513-
```
514-
515-
```vb
516-
' dotnet_style_parentheses_in_other_operators = always_for_clarity
517-
Dim v = (a.b).Length
518-
519-
' dotnet_style_parentheses_in_other_operators = never_if_unnecessary
520-
Dim v = a.b.Length
521-
```
522-
523-
These rules could appear in an *.editorconfig* file as follows:
524-
525-
```EditorConfig
526-
# CSharp and Visual Basic code style settings:
527-
[*.{cs,vb}]
528-
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
529-
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
530-
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
531-
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
532-
```
533-
534407
#### <a name="expression_level"></a>Expression-level preferences
535408

536409
The style rules in this section concern expression-level preferences, including the use of object initializers, collection initializers, explicit or inferred tuple names, and inferred anonymous types.
@@ -546,8 +419,6 @@ The following table shows the rule names, rule IDs, applicable programming langu
546419
| dotnet_style_prefer_inferred_anonymous_ type_member_names | IDE0037 | C# and Visual Basic | true:suggestion | 15.6 |
547420
| dotnet_style_prefer_auto_properties | IDE0032 | C# and Visual Basic | true:none | 15.7 |
548421
| dotnet_style_prefer_is_null_check_over_reference_equality_method | IDE0041 | C# and Visual Basic | true:suggestion | 15.7 |
549-
| dotnet_style_prefer_conditional_expression_over_assignment | IDE0045 | C# and Visual Basic | true:none | 15.8 |
550-
| dotnet_style_prefer_conditional_expression_over_return | IDE0046 | C# and Visual Basic | true:none | 15.8 |
551422

552423
**dotnet\_style\_object_initializer**
553424

@@ -744,77 +615,6 @@ If Object.ReferenceEquals(value, Nothing)
744615
End If
745616
```
746617

747-
**dotnet\_style\_prefer\_conditional\_expression\_over_assignment**
748-
749-
- When this rule is set to **true**, prefer assignments with a ternary conditional over an if-else statement.
750-
- When this rule is set to **false**, prefer assignments with an if-else statement over a ternary conditional.
751-
752-
Code examples:
753-
754-
```csharp
755-
// dotnet_style_prefer_conditional_expression_over_assignment = true
756-
string s = expr ? "hello" : "world";
757-
758-
// dotnet_style_prefer_conditional_expression_over_assignment = false
759-
string s;
760-
if (expr)
761-
{
762-
s = "hello";
763-
}
764-
else
765-
{
766-
s = "world";
767-
}
768-
```
769-
770-
```vb
771-
' dotnet_style_prefer_conditional_expression_over_assignment = true
772-
Dim s As String = If(expr, "hello", "world")
773-
774-
' dotnet_style_prefer_conditional_expression_over_assignment = false
775-
Dim s As String
776-
If expr Then
777-
s = "hello"
778-
Else
779-
s = "world"
780-
End If
781-
```
782-
783-
**dotnet\_style\_prefer\_conditional\_expression\_over_return**
784-
785-
- When this rule is set to **true**, prefer return statements to use a ternary conditional over an if-else statement.
786-
- When this rule is set to **false**, prefer return statements to use an if-else statement over a ternary conditional.
787-
788-
Code examples:
789-
790-
```csharp
791-
// dotnet_style_prefer_conditional_expression_over_return = true
792-
return expr ? "hello" : "world"
793-
794-
// dotnet_style_prefer_conditional_expression_over_return = false
795-
if (expr)
796-
{
797-
return "hello";
798-
}
799-
else
800-
{
801-
return "world";
802-
}
803-
```
804-
805-
```vb
806-
' dotnet_style_prefer_conditional_expression_over_return = true
807-
Return If(expr, "hello", "world")
808-
809-
' dotnet_style_prefer_conditional_expression_over_return = false
810-
If expr Then
811-
Return "hello"
812-
Else
813-
Return "world"
814-
End If
815-
```
816-
817-
818618
These rules could appear in an *.editorconfig* file as follows:
819619

820620
```EditorConfig
@@ -826,8 +626,6 @@ dotnet_style_explicit_tuple_names = true:suggestion
826626
dotnet_style_prefer_inferred_tuple_names = true:suggestion
827627
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
828628
dotnet_style_prefer_auto_properties = true:none
829-
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
830-
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
831629
```
832630

833631
#### <a name="null_checking"></a>Null-checking preferences
@@ -2189,23 +1987,17 @@ charset = utf-8-bom
21891987
dotnet_sort_system_directives_first = true
21901988

21911989
# this. preferences
2192-
dotnet_style_qualification_for_field = false:silent
2193-
dotnet_style_qualification_for_property = false:silent
2194-
dotnet_style_qualification_for_method = false:silent
2195-
dotnet_style_qualification_for_event = false:silent
1990+
dotnet_style_qualification_for_field = false:none
1991+
dotnet_style_qualification_for_property = false:none
1992+
dotnet_style_qualification_for_method = false:none
1993+
dotnet_style_qualification_for_event = false:none
21961994

21971995
# Language keywords vs BCL types preferences
2198-
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
2199-
dotnet_style_predefined_type_for_member_access = true:silent
2200-
2201-
# Parentheses preferences
2202-
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
2203-
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
2204-
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
2205-
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
1996+
dotnet_style_predefined_type_for_locals_parameters_members = true:none
1997+
dotnet_style_predefined_type_for_member_access = true:none
22061998

22071999
# Modifier preferences
2208-
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
2000+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:none
22092001
dotnet_style_readonly_field = true:suggestion
22102002

22112003
# Expression-level preferences
@@ -2214,12 +2006,10 @@ dotnet_style_collection_initializer = true:suggestion
22142006
dotnet_style_explicit_tuple_names = true:suggestion
22152007
dotnet_style_null_propagation = true:suggestion
22162008
dotnet_style_coalesce_expression = true:suggestion
2217-
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
2009+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:none
22182010
dotnet_prefer_inferred_tuple_names = true:suggestion
22192011
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
2220-
dotnet_style_prefer_auto_properties = true:silent
2221-
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
2222-
dotnet_style_prefer_conditional_expression_over_return = true:silent
2012+
dotnet_style_prefer_auto_properties = true:none
22232013

22242014
###############################
22252015
# Naming Conventions #
@@ -2241,17 +2031,17 @@ dotnet_naming_symbols.constant_fields.required_modifiers = const
22412031
###############################
22422032
[*.cs]
22432033
# var preferences
2244-
csharp_style_var_for_built_in_types = true:silent
2245-
csharp_style_var_when_type_is_apparent = true:silent
2246-
csharp_style_var_elsewhere = true:silent
2034+
csharp_style_var_for_built_in_types = true:none
2035+
csharp_style_var_when_type_is_apparent = true:none
2036+
csharp_style_var_elsewhere = true:none
22472037

22482038
# Expression-bodied members
2249-
csharp_style_expression_bodied_methods = false:silent
2250-
csharp_style_expression_bodied_constructors = false:silent
2251-
csharp_style_expression_bodied_operators = false:silent
2252-
csharp_style_expression_bodied_properties = true:silent
2253-
csharp_style_expression_bodied_indexers = true:silent
2254-
csharp_style_expression_bodied_accessors = true:silent
2039+
csharp_style_expression_bodied_methods = false:none
2040+
csharp_style_expression_bodied_constructors = false:none
2041+
csharp_style_expression_bodied_operators = false:none
2042+
csharp_style_expression_bodied_properties = true:none
2043+
csharp_style_expression_bodied_indexers = true:none
2044+
csharp_style_expression_bodied_accessors = true:none
22552045

22562046
# Pattern matching preferences
22572047
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
@@ -2265,7 +2055,7 @@ csharp_style_conditional_delegate_call = true:suggestion
22652055
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
22662056

22672057
# Expression-level preferences
2268-
csharp_prefer_braces = true:silent
2058+
csharp_prefer_braces = true:none
22692059
csharp_style_deconstructed_variable_declaration = true:suggestion
22702060
csharp_prefer_simple_default_expression = true:suggestion
22712061
csharp_style_pattern_local_over_anonymous_function = true:suggestion

0 commit comments

Comments
 (0)