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.03k stars 4.03k forks source link

Indentation for Lambda Functions not Working as expected #48856

Open vsfeedback opened 4 years ago

vsfeedback commented 4 years ago

This issue has been moved from a ticket on Developer Community.


This is what my method looks like after typing it with no typos. I have to fix the indentation manually, even Edit -> Advanced -> Format Document doesn't fix the indentation.

        public static void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Entity>(entity =>
            {
                entity. HasOne(e => e.Client)
                . WithMany(e => e.Entities)
                . HasForeignKey(f => f.ClientId);

entity. HasOne(e => e.EntityType)
                . WithMany(e => e.Entities)
                . HasForeignKey(k => k.EntityTypeId);
            });
        }

I would expect it to look like this:

        public static void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Entity>(entity =>
            {
                entity. HasOne(e => e.Client)
                    . WithMany(e => e.Entities)
                    . HasForeignKey(f => f.ClientId);

entity. HasOne(e => e.EntityType)
                    . WithMany(e => e.Entities)
                    . HasForeignKey(k => k.EntityTypeId);
            });
        }

Original Comments

Feedback Bot on 4/28/2020, 09:20 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 4/29/2020, 09:57 AM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.

Feedback Bot on 6/4/2020, 08:01 PM:

I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.


Original Solutions

(no solutions)

sharwell commented 4 years ago

Specific steps to reproduce

  1. Start with the following code:
public static void Method()
{
    value.Call(x =>
    {
        x.A().B();
    });
}
  1. Place the caret after A(), right before the .
  2. Press Enter

Expected result

public static void Method()
{
    value.Call(x =>
    {
        x.A()
            .B();
    });
}

Actual result

public static void Method()
{
    value.Call(x =>
    {
        x.A()
        .B();
    });
}