Skip to content

Instantly share code, notes, and snippets.

@benhysell
Created December 3, 2017 03:59
Show Gist options
  • Save benhysell/39f8bc04230fd0368d7b5fdc8b7bbce1 to your computer and use it in GitHub Desktop.
Save benhysell/39f8bc04230fd0368d7b5fdc8b7bbce1 to your computer and use it in GitHub Desktop.
vs2017 editor config
# EditorConfig is awesome:http://EditorConfig.org
# top-most EditorConfig file
root = true
# don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# CSharp and Visual Basic code style settings:
[*.{cs,vb}]
dotnet_style_require_accessibility_modifiers = always:suggestion
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
# CSharp code style settings:
[*.cs]
# CSharp code style settings:
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = never:none
csharp_style_expression_bodied_constructors = never:none
csharp_style_expression_bodied_operators = never:none
csharp_style_expression_bodied_properties = when_possible:suggestion
csharp_style_expression_bodied_indexers = when_possible:suggestion
csharp_style_expression_bodied_accessors = when_possible:suggestion
# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
# Public members must be capitalized (public_members_must_be_capitalized)
[*.{cs,vb}]
dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
dotnet_naming_symbols.public_symbols.applicable_kinds = property,method,field,event,delegate
dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
dotnet_naming_symbols.public_symbols.required_modifiers = readonly
dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
dotnet_naming_style.first_word_upper_case_style.capitalization = pascal_case
dotnet_naming_rule.public_members_must_be_capitalized.severity = error
# Private members must start with underscore
dotnet_naming_rule.private_members_must_start_underline.symbols = private_symbols
dotnet_naming_symbols.private_symbols.applicable_kinds = property,field
dotnet_naming_symbols.private_symbols.applicable_accessibilities = private,protected
#dotnet_naming_symbols.private_symbols.required_modifiers = *
dotnet_naming_rule.private_members_must_start_underline.style = underline_required
dotnet_naming_style.underline_required.required_prefix = _
dotnet_naming_style.underline_required.capitalization = camel_case
dotnet_naming_rule.private_members_must_start_underline.severity = error
# Async methods must end with Async
dotnet_naming_rule.async_methods_must_end_in_async.symbols = async_methods
dotnet_naming_symbols.async_methods.applicable_kinds = method
dotnet_naming_symbols.async_methods.applicable_accessibilities = *
dotnet_naming_symbols.async_methods.required_modifiers = async
dotnet_naming_rule.async_methods_must_end_in_async.style = async_required
dotnet_naming_style.async_required.required_suffix = Async
dotnet_naming_style.async_required.capitalization = pascal_case
dotnet_naming_rule.async_methods_must_end_in_async.severity = error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment