I would like to configure my EditorConfig (https://editorconfig.org/) configuration in a way that the C# code snippet var v = new Object(kind) {Id = num++};
is automatically reformatted to var v = new Object(kind) { Id = num++ };
by adding spaces after the opening and before the closing bracket. I went through the documentation and also checked the C# manual (https://learn.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#example-editorconfig-file) but couldn't quite find a solution yet.
Microsoft has implemented there own csharp and dotnet specific options for the .editorconfig.
Here are the up-to-date spacing options. I guess you want to do something like that:
// csharp_space_before_open_square_brackets = true
int [] numbers = new int [] { 1, 2, 3, 4, 5 };
// csharp_space_between_empty_square_brackets = true
int[ ] numbers = new int[ ] { 1, 2, 3, 4, 5 };
// csharp_space_between_square_brackets = true
int index = numbers[ 0 ];
Disclamer: For brackets, there are only square properties currently
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With