Skip to content

Conversation

@xtqqczze
Copy link
Contributor

@xtqqczze xtqqczze commented Nov 3, 2025

The only valid option values are ignore and false.

https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#csharp_space_around_declaration_statements

public static Option2<bool> SpacesIgnoreAroundVariableDeclaration { get; } = CreateOption(
CSharpFormattingOptionGroups.Spacing, "csharp_space_around_declaration_statements",
CSharpSyntaxFormattingOptions.SpacingDefault.HasFlag(SpacePlacement.IgnoreAroundVariableDeclaration),
new EditorConfigValueSerializer<bool>(
s => DetermineIfIgnoreSpacesAroundVariableDeclarationIsSet(s),
v => v ? "ignore" : "false"))

The only valid option values are `ignore` and `false`.
@xtqqczze xtqqczze requested a review from a team as a code owner November 3, 2025 17:46
@dotnet-policy-service dotnet-policy-service bot added Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode labels Nov 3, 2025
Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xtqqczze Thanks!

@xtqqczze
Copy link
Contributor Author

xtqqczze commented Nov 3, 2025

It should be noted that the invalid do_not_ignore option is widely used:

https://github.com/search?q=org%3Adotnet+%22csharp_space_around_declaration_statements+%3D+do_not_ignore%22+path%3A.editorconfig&type=code

It is also present in a test:

[Theory,
InlineData("do_not_ignore"),
InlineData(", "),
InlineData(" ignor ")]
public void TestDetermineIfIgnoreSpacesAroundVariableDeclarationIsSetFalse(string value)
=> Assert.False(CSharpFormattingOptions2.DetermineIfIgnoreSpacesAroundVariableDeclarationIsSet(value),
$"Expected option {value} to be un-set");
}

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

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants