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
19.12k stars 4.04k forks source link

Reformat braces for methods/properties/accessors on enter #17164

Open Pilchie opened 7 years ago

Pilchie commented 7 years ago

Given code like:

public int Property { get { $$return 42; } }

If the user hits enter at $$, we should fix the newlines for all the braces:

public int Property
{
    get
    {
        $$return 42;
    }
}

Similarly for single line methods, etc.

miloush commented 7 years ago

Unless the formatting preference is to keep opening braces on the same line I guess.

Also, what do you suggest to happen to the setter?