dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.88k stars 4.01k forks source link

.editorconfig not respecting object initializer rule #36865

Open josh-degraw opened 5 years ago

josh-degraw commented 5 years ago

Version Used: Visual Studio 16.1.4

Steps to Reproduce:

I have my .editorconfig set up for my project, and it mostly works well, but I've seen a problem where it doesn't seem to recognize my object initializer preference. This feels similar to #30529, but I'm still having the problem even though that was marked as resolved.

In my .editorconfig, I have the following settings (among more, which I can post if needed to see if there's something else overriding it):

csharp_new_line_before_open_brace = all
csharp_new_line_before_members_in_object_initializers = true

Expected Behavior:

I want my object intialization to look like this:

var obj = new MyObject
{
    Prop1 = 7373,
    Prop2 = "Hello world",
};

Actual Behavior:

When I run the code cleanup, it reformats the object initialization to:

var obj = new MyObject {
    Prop1 = 7373,
    Prop2 = "Hello world",
};
domagojmedo commented 3 months ago

Having same issue in 17.11.0 Preview 1.0