csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Inline if-return statement always has line break added

Open charliefoxtwo opened this issue 8 months ago • 0 comments

This may be something I'm just opinionated on, but I did test with prettier and prettier will reproduce the expected behavior in this issue.

Input:

public class ClassName {
    public string Foo() {
        if (true) return "foo";

        if (true)
            return "bar";

        if (true) return "some exceedingly long return value that exceeds the max line length limit of 100 chars";

        return "bar";
    }
}

Output:

public class ClassName
{
    public string Foo()
    {
        if (true)
            return "foo";

        if (true)
            return "bar";

        if (true)
            return "some exceedingly long return value that exceeds the max line length limit of 100 chars";

        return "bar";
    }
}

Expected behavior:

public class ClassName
{
    public string Foo()
    {
        if (true) return "foo";

        if (true) return "bar";

        if (true)
            return "some exceedingly long return value that exceeds the max line length limit of 100 chars";

        return "bar";
    }
}

charliefoxtwo avatar Jun 07 '24 05:06 charliefoxtwo