Visual studio 在visualstudio下使用editoconfig强制执行const的大写
我正在编写一个editorconfig文件来强制执行某些编码样式,并且我希望强制执行常量应为大写,因此我在editorconfig文件中创建了以下规则:Visual studio 在visualstudio下使用editoconfig强制执行const的大写,visual-studio,editorconfig,Visual Studio,Editorconfig,我正在编写一个editorconfig文件来强制执行某些编码样式,并且我希望强制执行常量应为大写,因此我在editorconfig文件中创建了以下规则: dotnet_naming_rule.constants_must_be_uppercase.symbols = public_constants dotnet_naming_symbols.public_constants.applicable_kinds = field dotn
dotnet_naming_rule.constants_must_be_uppercase.symbols = public_constants
dotnet_naming_symbols.public_constants.applicable_kinds = field
dotnet_naming_symbols.public_constants.applicable_accessibilities = *
dotnet_naming_symbols.public_constants.required_modifiers = const
dotnet_naming_rule.constants_must_be_uppercase.style = uppercase_with_underscore_separator
dotnet_naming_style.uppercase_with_underscore_separator.capitalization = all_upper
dotnet_naming_style.uppercase_with_underscore_separator.word_separator = _
dotnet_naming_rule.constants_must_be_uppercase.severity = warning
我正在使用以下代码对此进行测试:
namespace XYZ
{
public class Foo
{
public const string Bar = "bar";
}
}
但是,VisualStudio并不表示该行不正确。这是一个错误还是我的文件不正确?如果其他人像我一样偶然发现这个问题,请将此保留在这里 以下是我认为用于强制大写常量的.editorconfig行:
# Constants are UPPERCASE
dotnet_naming_rule.constants_should_be_upper_case.severity = suggestion
dotnet_naming_rule.constants_should_be_upper_case.symbols = constants
dotnet_naming_rule.constants_should_be_upper_case.style = constant_style
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.constant_style.capitalization = all_upper