diff --git a/.editorconfig b/.editorconfig
index 8247b27b..6696ba18 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,11 +12,12 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true
+[{*.yaml,*.yml}]
+indent_size = 2
+
[*.json]
ij_formatter_enabled = true
-indent_style = space
indent_size = 2
-trim_trailing_whitespace = true
# C# files
[*.cs]
@@ -29,9 +30,6 @@ csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
-# ReSharper properties
-resharper_wrap_object_and_collection_initializer_style = chop_always
-
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
@@ -77,13 +75,14 @@ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
csharp_using_directive_placement = outside_namespace:error
dotnet_sort_system_directives_first = true
csharp_prefer_braces = true:warning
-csharp_preserve_single_line_blocks = false
-csharp_preserve_single_line_statements = false
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_simple_using_statement = false:none
csharp_style_prefer_switch_expression = true:suggestion
dotnet_style_readonly_field = true:suggestion
+# csharp_preserve_single_line_blocks = false
+# csharp_preserve_single_line_statements = false
+
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
@@ -105,13 +104,11 @@ csharp_style_expression_bodied_operators = false:warning
csharp_style_expression_bodied_properties = false:warning
csharp_style_expression_bodied_indexers = false:warning
csharp_style_expression_bodied_accessors = false:warning
-csharp_style_expression_bodied_lambdas = false:warning
csharp_style_expression_bodied_local_functions = false:warning
+csharp_style_expression_bodied_lambdas = true
# Pattern matching
-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_prefer_pattern_matching = false:warning
# Null checking preferences
csharp_style_throw_expression = true:suggestion
@@ -121,6 +118,7 @@ csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_index_operator = false:none
csharp_style_prefer_range_operator = false:none
csharp_style_pattern_local_over_anonymous_function = false:none
+csharp_style_inlined_variable_declaration = true
# Space preferences
csharp_space_after_cast = true
@@ -145,6 +143,10 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_square_brackets = false
+# ReSharper properties
+resharper_wrap_object_and_collection_initializer_style = chop_always
+resharper_merge_into_pattern_highlighting = none
+
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml
new file mode 100644
index 00000000..17cd3b56
--- /dev/null
+++ b/.github/workflows/dotnet-format.yml
@@ -0,0 +1,37 @@
+name: .NET Format
+
+on:
+ push:
+ branches:
+ - develop
+ pull_request:
+ branches: ["*"]
+ branches-ignore:
+ - main
+
+jobs:
+ dotnet-format:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ token: ${{ secrets.BYPASS_WORKFLOW_PAT }}
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 9.0
+
+ - name: Restore Tool Dependencies
+ run: dotnet tool install -g csharpier
+
+ - name: CSharpier Format
+ run: csharpier format .
+
+ - uses: stefanzweifel/git-auto-commit-action@v6
+ with:
+ commit_message: .NET Format Style Fixes
+ commit_user_name: Format Bot
diff --git a/server-csharp.sln.DotSettings b/server-csharp.sln.DotSettings
index 34e0f2f3..4ea34dbf 100644
--- a/server-csharp.sln.DotSettings
+++ b/server-csharp.sln.DotSettings
@@ -2,6 +2,7 @@
True
True
True
+ True
True
True
True
\ No newline at end of file