dotnet/roslyn

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

Aberta

#50.017 aberto em 16 de dez. de 2020

 (1 comentário) (0 reação) (0 responsável)C# (4.257 forks)batch import
Area-IDEBugIDE-Formatterhelp wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

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

Guia do colaborador