Hi!
I'm using the editorconfig file to fine-tune the coding style settings across multiple visual studio instances. Specifically, I want to configure the placement of the open brace. The csharp_new_line_before_open_brace setting gives me some headache:
When I set
csharp_new_line_before_open_brace = all
I get new lines for Object Initializers like so:
var foo = new Foo
{
Name = "Hello World",
Id = 0,
};
When I explicitly specify the individual settings, (which I want, because I'd like to disable specific things like the new line for control statements) like so:
csharp_new_line_before_open_brace = accessors, anonymous_methods, anonymous_types, control_blocks, events, indexers, lambdas, local_functions, methods, object_collection_array_initializers, properties, types
the code formatter produces this (the opening brace is _not_ (!) placed on new line):
var foo = new Foo {
Name = "Hello World",
Id = 0,
};
Note, I enabled all available values according to https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017#newline).
So, AFAICT this should be the same as "all".
Am I missing something, or is this an issue within VS?
Thanks, david
_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/350663/issue-with-object-initializers-and-csharp-new-line.html
VSTS ticketId: 699427_
_These are the original issue comments:_
(no comments)
_These are the original issue solutions:_
(no solutions)
馃悰 The underlying problems is the following setting is misspelled.
We need to update the code so the correct spelling is supported, and also preserve support for the original value.
I will pick this up and fix it, if it's ok for you?
@Rumpel78 sure thing!
still happening in visual studio professional 2017 15.9.7
@jaroslav-rfe This issue was fixed for the first release of Visual Studio 2019.
Most helpful comment
I will pick this up and fix it, if it's ok for you?