[Bug?] Incorrect indentation when pressing Enter between auto‑inserted braces (LINQPad 9)

Environment:

  • LINQPad 9 (bug exists)
  • LINQPad 5 / LINQPad 8 / Visual Studio (no issue)

Description

When coding in C# Statement mode, entering a { automatically inserts the matching } as expected. However, when pressing Enter between the auto‑generated braces, LINQPad 9 produces incorrect indentation.

Example

Starting with this code (cursor shown as I):

DoWork();

void DoWork()
{
    if (3 < 4)
    {I
}

After typing {, LINQPad auto‑generates the closing brace:

DoWork();

void DoWork()
{
    if (3 < 4)
    {I}
}

Now the cursor is between {}.
When pressing Enter, LINQPad 9 incorrectly formats it as:

DoWork();

void DoWork()
{
    if (3 < 4)
    {
    I}
}

Expected behavior

Proper indentation:

DoWork();

void DoWork()
{
    if (3 < 4)
    {
        I
    }
}

Additional case

After the broken formatting occurs, if the code is in this state:

DoWork();

void DoWork()
{
    if (3 < 4)
    {I
    }
}

Pressing Enter again results in:

DoWork();

void DoWork()
{
    if (3 < 4)
    {
    I
    }
}

But the expected output is:

DoWork();

void DoWork()
{
    if (3 < 4)
    {
        I
    }
}

Not limited to “C# Statement” mode

The same issue occurs in C# Program mode. Example:

Initial:

public static class Program
{
    public static void Main()
    {|
    }
}

After pressing Enter:

public static class Program
{
    public static void Main()
    {
    I
    }
}

Summary

LINQPad 9 introduces incorrect indentation when pressing Enter between auto‑generated brace pairs. This regression does not occur in LINQPad 5, LINQPad 8, or Visual Studio.