简体   繁体   English

.editorconfig命名约定不起作用

[英].editorconfig naming convention not working

I'm trying to create a naming convention for my constants for VS 2017. The problem is that there is some kind of conflict with the rules because I'm getting this error when I define a constant like this: 我正在尝试为VS 2017创建常量的命名约定。问题是与规则存在某种冲突,因为我在定义这样的常量时遇到此错误:

private const string HOLAMUCHACHO = "1";

"First word "HOLAMUCHACHO" must start with a lowercase char". “第一个字”HOLAMUCHACHO“必须以小写字母”开头“。

This is my .editorconfig: 这是我的.editorconfig:

## Private members must be camelCase
dotnet_naming_style.private_field_style.capitalization = camel_case

dotnet_naming_rule.private_fields_are_camel_case.severity = error
dotnet_naming_rule.private_fields_are_camel_case.symbols = private_field_symbol
dotnet_naming_rule.private_fields_are_camel_case.style = private_field_style

dotnet_naming_symbols.private_field_symbol.applicable_kinds = field
dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private

## Constants must be UPPER_CASE
dotnet_naming_style.upper_case_style.capitalization = all_upper
dotnet_naming_style.upper_case_style.word_separator = _

dotnet_naming_rule.constant_fields_should_be_upper_case.severity = error
dotnet_naming_rule.constant_fields_should_be_upper_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_upper_case.style = upper_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

Any ideas? 有任何想法吗? Thanks in advance. 提前致谢。

好吧,所以把const规则放在私有成员之上似乎工作:更具体的规则首先:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM