James Ko
James Ko

Reputation: 34499

How to configure Visual Studio to not indent closing parenthesis on multiline function calls?

I'm using Visual Studio 2017 RC (but this probably applies to 2015 and earlier versions as well). I'm working on a C# project where I have lots of code that looks like this:

Ast = new Ast(
    CallExpression("add")
    .AddChildren(
        NumberLiteral("4"),
        NumberLiteral("9")
    )
)

As you can see, the code takes a nested structure where closing parenthesis match the indentation of the original function call.

My problem is that when my cursor is in between the parentheses of a new function call:

Ast = new Ast([|])

and I hit Enter:

Ast = new Ast(
    [|])

there are an extra 4 spaces left behind the closing parens, not matching the original indentation. What I want is this:

Ast = new Ast(
[|])

Is there any way to configure VS to not add those extra spaces when hitting Enter in such a context? Thanks.

Upvotes: 1

Views: 386

Answers (1)

Sergey Vasiliev
Sergey Vasiliev

Reputation: 823

You can try this:

Tools->Options->Text Editor->C#->Indenting->Block.

valid XHTML

Upvotes: 1

Related Questions