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

Blocks inside of other blocks are getting an extra new line. #316

Closed
respel opened this issue Jun 15, 2021 · 2 comments · Fixed by #347
Closed

Blocks inside of other blocks are getting an extra new line. #316

respel opened this issue Jun 15, 2021 · 2 comments · Fixed by #347
Assignees
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@respel
Copy link

respel commented Jun 15, 2021

//Is
switch (x)
{
    case 1:

        {
            return 1;
        }
        break;
}

//ShouldBe
switch (x)
{
    case 1:
        {
            return 1;
        }
        break;
}
              

There's an extra line when there's a scope block introduced.
Reference

@belav
Copy link
Owner

belav commented Jun 15, 2021

It looks like this is actually a problem with block. I think this example makes it more clear what is going on

        switch (x)
        {
            case 1:
            {

                {
                    return 1;
                }
                break;
            }
        }

It also happens here

    void MethodName()
    {

        {
            var x = 1;
        }
    }

We may be assuming that a block always needs to start with a line, which causes a double line in these cases.

@belav belav added type:bug Something isn't working area:formatting labels Jun 15, 2021
@respel respel changed the title "case" with curly braces Better format scope blocks Jun 15, 2021
@respel
Copy link
Author

respel commented Jun 15, 2021

@belav I see. You're completely right. I've updated the title to reflect that

@belav belav self-assigned this Jul 11, 2021
@belav belav added this to the 0.9.8 milestone Jul 11, 2021
belav added a commit that referenced this issue Jul 11, 2021
@belav belav changed the title Better format scope blocks Blocks inside of other blocks are getting an extra new line. Jul 11, 2021
belav added a commit that referenced this issue Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants