root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{md,markdown}]
trim_trailing_whitespace = false

[*.{yml,yaml,json}]
indent_size = 2

[*.{csproj,props,targets,slnx,xml,config,resx}]
indent_size = 2

[*.{cs,vb}]

# IDE0130: Namespace does not match folder structure
dotnet_style_namespace_match_folder = false

[*.cs]

# IDE0160: Convert to block scoped namespace
dotnet_diagnostic.IDE0160.severity = silent

# IDE0005 / ReSharper redundant-using: this solution multi-targets net10.0 and net10.0-windows
# with #if WINDOWS code, so some usings are legitimately used on only one TFM and look "unused"
# on the other. We intentionally keep them inline and do NOT optimize usings during cleanup, so
# silence the unused-using diagnostic (it would otherwise break the build under
# TreatWarningsAsErrors and show as a spurious editor suggestion).
dotnet_diagnostic.IDE0005.severity = none
resharper_redundant_using_directive_highlighting = none

# Always use braces - no single-line if/else/for/while/using
csharp_prefer_braces = true:warning

# Prefer file-scoped namespaces
csharp_style_namespace_declarations = file_scoped:warning

# Prefer explicit type over var unless the type is apparent from the RHS
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Prefer pattern matching and modern C# idioms (enforced)
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_switch_expression = true:warning

# Prefer target-typed new (enforced)
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning

# Prefer collection expressions (enforced)
dotnet_style_prefer_collection_expression = true:warning

# Standard C#: no space before parentheses in calls/declarations (`Method(arg)`, `new()`),
# but keep a space after control-flow keywords (`if (x)`, `while (x)`).
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_after_keywords_in_control_flow_statements = true

# ReSharper space knobs - dotnet format reads the csharp_space_* keys above, but ReSharper has
# additional knobs. Kept in sync with the standard no-space-before-parens style above.
resharper_space_before_new_parentheses = false
resharper_space_before_method_call_parentheses = false
resharper_space_before_method_parentheses = false
resharper_space_before_empty_method_call_parentheses = false
resharper_space_before_empty_method_parentheses = false
resharper_space_before_typeof_parentheses = false
resharper_space_before_default_parentheses = false
resharper_space_before_checked_parentheses = false
resharper_space_before_sizeof_parentheses = false
resharper_space_before_nameof_parentheses = false
