Skip to content

Formatter requires two passes for comments in lambdas #60437

@davidwengier

Description

@davidwengier

Version Used: 17.2.0 Preview 3.0 [32327.42.main]

Similar to #57465 and found because it's blocking the same Razor formatting issues that issue was blocking.

Given:

namespace N
{
    public class C
    {
        protected void Render()
        {
if (true)
            {
            M(() => 
            {
                if (true)
                {
/* marker */
                                    }
                                });
                }
        }
    }
}

Formatting the document once gives:

namespace N
{
    public class C
    {
        protected void Render()
        {
            if (true)
            {
                M(() =>
                {
                    if (true)
                    {
                    /* marker */
                    }
                });
            }
        }
    }
}

Formatting a second time gives:

namespace N
{
    public class C
    {
        protected void Render()
        {
            if (true)
            {
                M(() =>
                {
                    if (true)
                    {
                        /* marker */
                    }
                });
            }
        }
    }
}

Fixing this bug should fix dotnet/razor#6001 and dotnet/razor#5676

Metadata

Metadata

Assignees

Labels

Area-IDEBugIDE-FormatterCode formatter and/or smart indentResolution-FixedThe bug has been fixed and/or the requested behavior has been implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions