Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline if-return statement always has line break added #1281

Open
charliefoxtwo opened this issue Jun 7, 2024 · 0 comments
Open

Inline if-return statement always has line break added #1281

charliefoxtwo opened this issue Jun 7, 2024 · 0 comments

Comments

@charliefoxtwo
Copy link
Sponsor

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";
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant