-
Notifications
You must be signed in to change notification settings - Fork 16
/
.editorconfig
132 lines (115 loc) · 7.13 KB
/
.editorconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
root = true
[*]
charset = utf-8
# 设置文件的行尾字符为 LF(Line Feed)。
end_of_line = lf
# 设置缩进的大小为 4 个空格
indent_size = 4
# 设置缩进的样式为空格
indent_style = space
# 设置在文件的末尾插入一个新行,可以防止某些工具在处理文件时出现问题
insert_final_newline = true
# 设置删除每一行末尾的尾随空格
trim_trailing_whitespace = true
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions
[*.cs]
## 接口示例:IPascalCase
# 定义了一个命名规则 interface_rule,它将应用于 interface_symbol 定义的符号。
dotnet_naming_rule.interface_rule.symbols = interface_symbol
dotnet_naming_rule.interface_rule.style = interface_style
# 规则被违反时,将发出的警告级别。
dotnet_naming_rule.interface_rule.severity = warning
# 指定符号的应用程序类型。可用的值为:class,struct,interface,enum,delegate,method,property,event,field,parameter,namespace,property,local,interface
dotnet_naming_symbols.interface_symbol.applicable_kinds = interface
# interface_style 样式要求的前缀,这里是 "I"。
dotnet_naming_style.interface_style.required_prefix = I
# interface_style 样式的命名约定,这里是 PascalCase。
dotnet_naming_style.interface_style.capitalization = pascal_case
# camelCase:在这种命名约定中,第一个单词的首字母小写,后面每个单词的首字母大写,例如:myVariableName。
# PascalCase:在这种命名约定中,每个单词的首字母都大写,例如:MyVariableName。
# snake_case:在这种命名约定中,单词之间用下划线分隔,例如:my_variable_name。
# ALL_UPPER:在这种命名约定中,所有字母都大写,例如:MY_VARIABLE_NAME。
## 类,结构,枚举,委托,方法,属性,事件示例: MyClass
dotnet_naming_rule.pascal_case_rule.symbols = pascal_case_symbol
dotnet_naming_rule.pascal_case_rule.style = pascal_case_style
dotnet_naming_rule.pascal_case_rule.severity = warning
dotnet_naming_symbols.pascal_case_symbol.applicable_kinds = class,struct,enum,delegate,method,property,event
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
## 私有字段示例: m_VariableName
dotnet_naming_rule.private_field_rule.symbols = private_field_symbol
dotnet_naming_rule.private_field_rule.style = private_field_style
dotnet_naming_rule.private_field_rule.severity = warning
dotnet_naming_symbols.private_field_symbol.applicable_kinds = field
dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private
# private_field_style 样式要求的前缀,这里是 "m_"
dotnet_naming_style.private_field_style.required_prefix = m_
dotnet_naming_style.private_field_style.capitalization = pascal_case
## 非私有字段示例: myVariableName
dotnet_naming_rule.non_private_field_rule.symbols = non_private_field_symbol
dotnet_naming_rule.non_private_field_rule.style = non_private_field_style
dotnet_naming_rule.non_private_field_rule.severity = warning
dotnet_naming_symbols.non_private_field_symbol.applicable_kinds = field
dotnet_naming_symbols.non_private_field_symbol.applicable_accessibilities = public,internal,protected,protected_internal
# non_private_field_style 样式的命名约定,这里是 camelCase。
dotnet_naming_style.non_private_field_style.capitalization = camel_case
# 静态字段示例: VariableName
dotnet_naming_rule.static_field_rule.symbols = static_field_symbol
dotnet_naming_rule.static_field_rule.style = static_field_style
dotnet_naming_rule.static_field_rule.severity = warning
dotnet_naming_symbols.static_field_symbol.applicable_kinds = field
dotnet_naming_symbols.static_field_symbol.required_modifiers = static
# dotnet_naming_style.static_field_style.required_prefix = s_
dotnet_naming_style.static_field_style.capitalization = pascal_case
## 参数示例: myVariableName
dotnet_naming_rule.parameter_rule.symbols = parameter_symbol
dotnet_naming_rule.parameter_rule.style = parameter_style
dotnet_naming_rule.parameter_rule.severity = warning
dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
# parameter_style 样式的命名约定,这里是 camelCase。
dotnet_naming_style.parameter_style.capitalization = camel_case
## 常量示例: MY_VARIABLE_NAME
dotnet_naming_rule.const_rule.symbols = const_symbol
dotnet_naming_rule.const_rule.style = const_style
dotnet_naming_rule.const_rule.severity = warning
dotnet_naming_symbols.const_symbol.required_modifiers = const
dotnet_naming_symbols.const_symbol.applicable_kinds = field
# const_style 样式的命名约定,这里是 ALL_UPPER。
dotnet_naming_style.const_style.capitalization = all_upper
# const_style 样式的单词分隔符,这里是 "_"
dotnet_naming_style.const_style.word_separator = _
# # 常量示例: k_VARIABLE_NAME
# dotnet_naming_rule.const_rule.symbols = const_symbol
# dotnet_naming_rule.const_rule.style = const_style
# dotnet_naming_rule.const_rule.severity = warning
# dotnet_naming_symbols.const_symbol.required_modifiers = const
# dotnet_naming_symbols.const_symbol.applicable_kinds = field
# dotnet_naming_style.const_style.required_prefix = k_
# dotnet_naming_style.const_style.capitalization = all_upper
# dotnet_naming_style.const_style.word_separator = _
# 格式化规则
# 在所有情况下,在打开大括号之前换行
csharp_new_line_before_open_brace = all
# 在 else 之前换行
csharp_new_line_before_else = true
# 在 catch 之前换行
csharp_new_line_before_catch = true
# 在 finally 之前换行
csharp_new_line_before_finally = true
# 在对象初始化器中的成员之前换行
csharp_new_line_before_members_in_object_initializers = true
# 在匿名类型中的成员之前换行
csharp_new_line_before_members_in_anonymous_types = true
# 在查询表达式子句之间换行
csharp_new_line_between_query_expression_clauses = true
# 使用规则
# 不需要字段的限定符
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
# 其他规则
# 将 System 指令放在 using 指令的顶部
dotnet_sort_system_directives_first = true