Skip to content

Formatter doesn't handle when blocks correctly #62

@jaredpar

Description

@jaredpar

Consider the following code snippet:

class C
{
    void M()
    {
        try
        {
            if(x){
                G();
            }
        }
        catch(Exception e) when (H(e))
        {

        }
    }
}

If this is passed to the Formatter API it will output the following:

class C
{
    void M()
    {
        try
        {
            if (x)
            {
                G();
            }
        }
        catch (Exception e) when(H(e))
        {

        }
        }
    }

This output has the following bugs:

  • The last two } braces are not correctly indented
  • There should be a space between when and (. The current behavior is inconsistent with how we format other similar operators.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions