dotnet/roslyn

Delegates are not properly reformatted when converting property from expression body to block body

Open

#71,637 opened on Jan 14, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-IDEBughelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

Version Used: VS 17.8.4

Steps to Reproduce:

For both properties, open the lightbulb menu and select "Use block body for property".

class C
{
    Action A => delegate
    {
    };

    Action A2 => () =>
    {
    };
}

Expected Behavior: The block of the delegate or lambda is correctly indented. image

Actual Behavior: The indentation of the delegate body is not changed.

Interestingly, type creation expression within the property body are correctly formatted/indented: image

Contributor guide