How to automatically place cursor between braces on its own line using Visual Studio 2017

Viewed 377

When I place an open brace in Visual Studio 2017 (C#) the cursor automatically goes to the next line to the left of the end brace. Like this (period as cursor):

if() {
.}

I'd like the cursor to automatically be on its own line like this (period as cursor):

if() {
    .
}

Does anybody know how to make the cursor automatically go where the period is in the second example?

4 Answers

If you want to automatically place the cursor inside the curly braces (i.e. without any shortcut), you can enable that from Tools -> Options -> Text Editor -> C/C++ -> Formatting -> (check) Automatically format braces when they are automatically completed.

Of course, this is for C/C++. I don't use C# so I haven't tried for C#, but it should be similar, probably Tools -> Options -> Text Editor -> C# -> Code Style -> Formatting -> (check) Automatically format block on } (please correct me if I'm wrong).

Related