Reputation: 2434
I have an .editorconfig
file that has my naming preferences in it. When I run code cleanup, it automatically formats seemingly all of my other preferences besides the naming. When I hover over a variable that is violating a naming preference it tells me which one it is violating and I can right click to change it to the correct format, but this does not automatically happen when running code cleanup like the rest of my preferences.
Am I missing a VS setting to automatically apply naming preferences from an .editorconfig
when running code cleanup?
Example Preference Notification:
Editor Config naming preference:
# Naming rules
dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_underscore_prefixed_camel_case.style = underscore_prefixed_camel_case
# Symbol specifications
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.applicable_accessibilities = *
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.local_method_variable.applicable_kinds = field, parameter
dotnet_naming_symbols.local_method_variable.applicable_accessibilities = local
dotnet_naming_symbols.local_method_variable.required_modifiers =
dotnet_naming_symbols.private_const_variable.applicable_kinds = field
dotnet_naming_symbols.private_const_variable.applicable_accessibilities = private
dotnet_naming_symbols.private_const_variable.required_modifiers = const
dotnet_naming_symbols.local_const_variable.applicable_kinds = field
dotnet_naming_symbols.local_const_variable.applicable_accessibilities = local
dotnet_naming_symbols.local_const_variable.required_modifiers = const
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.underscore_prefixed_camel_case.required_prefix = _
dotnet_naming_style.underscore_prefixed_camel_case.required_suffix =
dotnet_naming_style.underscore_prefixed_camel_case.word_separator =
dotnet_naming_style.underscore_prefixed_camel_case.capitalization = camel_case
Upvotes: 6
Views: 2015
Reputation: 1433
I think there is some issue with how you are configuring the your naming styles.
This is a complete guide for how to Configure Naming Styles and Rules in Visual Studio and also at the solution/project level with an .editorconfig file.
The important thing to note is that:
"solution or a project can override these rules, so that everyone who works on the solution/project is using the same rules, no matter what they have configured in Visual Studio".
As you can see a sample example in this pic:
Upvotes: 2
Reputation: 23244
For now, the kind of fixers that can be run via Code Cleanup is limited to a predefined set, which doesn't include one to handle the IDE1006
case.
There's an open issue on GitHub about having more control over this.
From Kendra Havens, a product manager on the Visual Studio team:
Currently fixers included in a code cleanup profile are added by the product team on a case-by-case basis. Only then can they be included by users. Since all fixers, (including 3rd party fixers) can be specified in EditorConfig it'd be natural to be able to include any of those in a code cleanup profile.
Upvotes: 2