.editorconfig 2.8 KB
Newer Older
1
# EditorConfig is awesome:http://EditorConfig.org
S
Shapkin Arkady 已提交
2 3 4 5

# top-most EditorConfig file
root = true

6
# Don't use tabs for indentation.
S
Shapkin Arkady 已提交
7 8
[*]
indent_style = space
9 10 11
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
12
[*.{cs,csx,vb,vbx}]
S
Shapkin Arkady 已提交
13
indent_size = 4
14
insert_final_newline = true
15
charset = utf-8-bom
S
Shapkin Arkady 已提交
16 17 18 19 20 21 22 23

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
24 25 26 27

# JSON files
[*.json]
indent_size = 2
28 29

# Dotnet code style settings:
30
[*.{cs,vb}]
31 32
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
33
# Avoid "this." and "Me." if not necessary
34 35 36 37
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
38

39
# Use language keywords instead of framework type names for type references
40 41
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
42 43

# Suggest more modern language features when available
44 45 46 47
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
48
dotnet_style_explicit_tuple_names = true:suggestion
49 50

# CSharp code style settings:
51
[*.cs]
52
# Prefer "var" everywhere
53 54
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
K
Kasey Uhlenhuth 已提交
55
csharp_style_var_elsewhere = true:suggestion
56 57

# Prefer method-like constructs to have a block body
58
csharp_style_expression_bodied_methods = false:none
59 60
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
61 62

# Prefer property-like constructs to have an expression-body
63 64 65
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
66 67

# Suggest more modern language features when available
68 69 70 71
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
72 73 74 75 76 77 78 79 80
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true