Skip to content

Instantly share code, notes, and snippets.

@jmarolf
Last active September 26, 2023 12:55
Show Gist options
  • Save jmarolf/f53955b5ebc5f8ff8f3ce6ad5f64ce31 to your computer and use it in GitHub Desktop.
Save jmarolf/f53955b5ebc5f8ff8f3ce6ad5f64ce31 to your computer and use it in GitHub Desktop.
List of all options and how they may be implemented in editorconfig

Advanced

editorconfig name possible values
dotnet_sort_system_directives_first true , false

Indentation Options

editorconfig name possible values
csharp_indent_block_contents true , false
csharp_indent_braces true , false
csharp_indent_case_contents true , false
csharp_indent_case_labels true , false
csharp_label_indentation left_most , no_indent , one_less_than_current

New Line Options

editorconfig name possible values
csharp_open_brace_on_new_line types, methods, properties, indexers, events, event_accessors, anonymous_methods, control_blocks, anonymous_types, object_collections, array_initializers, lambdas, local_functions, all, none (or separate with ';')
csharp_else_on_new_line true , false
csharp_catch_on_new_line true , false
csharp_finally_on_new_line true , false
csharp_members_in_object_initializers_on_new_line true , false
csharp_members_in_anonymouse_types_on_new_line true , false
csharp_query_expression_clauses_on_new_line true , false

Spacing Options

editorconfig name possible values
csharp_space_after_cast true , false
csharp_spaces_in_declaration_statements true , false
csharp_space_before_open_square_brackets true , false
csharp_space_within_empty_square_brackets true , false
csharp_space_within_square_brackets true , false
csharp_space_after_colon_for_base_or_interface_in_type_declaration true , false
csharp_space_after_comma true , false
csharp_space_after_dot true , false
csharp_space_after_semicolon_in_for_statement true , false
csharp_space_before_colon_for_base_or_interface_in_type_declaration true , false
csharp_space_before_comma true , false
csharp_space_before_dot true , false
csharp_space_before_semicolon_in_for_statement true , false
csharp_space_between_method_declaration_name_and_open_parenthesis true , false
csharp_space_within_method_declaration_parameter_list_parenthesis true , false
csharp_space_within_method_declaration_empty_parameter_list_parentheses true , false
csharp_space_between_method_call_name_and_opening_parenthesis true , false
csharp_space_within_method_call_parameter_list_parenthesis true , false
csharp_space_within_method_call_empty_parameter_list_parentheses true , false
csharp_space_after_keywords_in_control_flow_statements true , false
csharp_space_within_parentheses expressions, type_casts, control_flow_statements
csharp_space_around_operators none, before_and_after, ignore

Wrapping Options

editorconfig name possible values
csharp_block_on_single_line true , false
csharp_statements_and_member_declarations_on_same_line true , false

Code Style Options

editorconfig name possible values
csharp_this_qualification_for_field true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_this_qualification_for_property true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_this_qualification_for_method true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_this_qualification_for_event true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
visualbasic_me_qualification_for_field true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
visualbasic_me_qualification_for_property true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
visualbasic_me_qualification_for_method true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
visualbasic_me_qualification_for_event true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_var_for_locals true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_predefined_type_for_locals_parameters_members true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
chsarp_predefined_type_for_member_access true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_var_for_build_in_types true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_var_when_type_is_apparent true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_var_for_elsewhere true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_methods true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_constructors true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_operators true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_properties true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_indexers true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_expression_bodied_accessors true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_object_initializer true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_pattern_matching_over_is_with_cast_check true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_pattern_matching_over_as_with_null_check true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_inlined_variable_declaration true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_throw_expression true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error
csharp_conditional_delegate_call true; severity = none,suggestion,warning,error , false; severity = none,suggestion,warning,error

Naming Style Options

editorconfig name possible values
dotnet_naming_rule.<naming rule title>.severity none , suggestion , warning , error
dotnet_naming_rule.<naming rule title>.symbols <naming symbols title>
dotnet_naming_rule.<naming rule title>.style <naming stlye title>
dotnet_naming_symbols.<naming symbols title>.applicable_kinds class;struct;interface;enum;property;method;field;event;namespace;delegate;type_parameter
dotnet_naming_symbols.<naming symbols title>.applicable_accessibilities public;internal;private;protected;protected_internal
dotnet_naming_symbols.<naming symbols title>.required_modifiers abstract;async;cont;readonly;static
dotnet_naming_style.<naming style title>.required_prefix string
dotnet_naming_style.<naming style title>.required_suffix string
dotnet_naming_style.<naming style title>.word_separator string
dotnet_naming_style.<naming style title>.capitalization pascal_case , camel_case , first_word_upper , all_upper , all_lower

Naming Style Examples

# Example: Pascal Casing
[*.{cs,vb}]
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.severity = warning
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.symbols  = method_and_property_symbols
dotnet_naming_rule.methods_and_properties_must_be_pascal_case.style    = pascal_case_style

dotnet_naming_symbols.method_and_property_symbols.applicable_kinds           = method;property
dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *

dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Example: async methods end in Async
[*.{cs,vb}]
dotnet_naming_rule.async_methods_must_end_with_async.severity = warning
dotnet_naming_rule.async_methods_must_end_with_async.symbols  = method_symbols
dotnet_naming_rule.async_methods_must_end_with_async.style    = end_in_async_style

dotnet_naming_symbols.method_symbols.applicable_kinds   = method
dotnet_naming_symbols.method_symbols.required_modifiers = async

dotnet_naming_style.end_in_async_style.capitalization  = pascal_case
dotnet_naming_style.end_in_async_style.required_suffix = Async
# Example: public members must be capitalized
[*.{cs,vb}]
dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
dotnet_naming_rule.public_members_must_be_capitalized.symbols  = public_symbols
dotnet_naming_rule.public_members_must_be_capitalized.style    = first_word_upper_case_style

dotnet_naming_symbols.public_symbols.applicable_kinds   = property;method;field;event;delegate
dotnet_naming_symbols.public_symbols.required_modifiers = public;internal;protected;protected_internal

dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
# Example: non-public members must be lower-case
[*.{cs,vb}]
dotnet_naming_rule.non_public_members_must_be_lower_case.severity = warning
dotnet_naming_rule.non_public_members_must_be_lower_case.symbols  = non_public_symbols
dotnet_naming_rule.non_public_members_must_be_lower_case.style    = all_lower_case_style

dotnet_naming_symbols.non_public_symbols.applicable_kinds   = property;method;field;event;delegate
dotnet_naming_symbols.non_public_symbols.required_modifiers = private

dotnet_naming_style.all_lower_case_style.capitalization = all_lower
@jasonmalinowski
Copy link

csharp_spacing_for_operators, perhaps csharp_space_around_operators? It's the only one with 'spacing'.

@jasonmalinowski
Copy link

csharp_predefined_type_for_locals_parameter_members, keep them all plural?

@marknadig
Copy link

marknadig commented Jul 24, 2017

Is there a single source of truth for editorconfig values that vs2017 supports @jmarolf? This seems like an attempt at one but hoping to find one in roslyn repo or.... ah, found dotnet/roslyn#18342 linking for ref.

@binki
Copy link

binki commented Nov 17, 2017

Why do you have accessibility modifiers listed under required_modifiers?

@binki
Copy link

binki commented Nov 17, 2017

If applicable_accessibilities is really optional, why bother specifying * as a value ever?

@jez9999
Copy link

jez9999 commented Dec 29, 2018

Is there a way to allow any capitalization for dotnet_naming_style...capitalization? I want to specify that methods should have a certain suffix, but I don't care about the rest of the capitalization style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment