dotnet/roslyn

Unexpected formatting when attribute is on same line as property with default value

Aperta

#50.017 aperta il 16 dic 2020

 (1 commento) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEBugIDE-Formatterhelp wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

The code

namespace Foo
{
    public class Bar
    {
        [Parameter] public DelegateType Value { get; set; } = (value, second) => (builder) =>
        {
            builder.Baz();
        };
    }
}

reformats to

namespace Foo
{
    public class Bar
    {
        [Parameter]
        public DelegateType Value { get; set; } = (value, second) => (builder) =>
{
builder.Baz();
};
    }
}

I would expect

namespace Foo
{
    public class Bar
    {
        [Parameter]
        public DelegateType Value { get; set; } = (value, second) => (builder) =>
        {
            builder.Baz();
        };
    }
}

or actually to do nothing at all.


dotnet format version is 4.1.131201

Guida contributor