Wad
Wad

Reputation: 1534

VS2017 indenting on braces in C++

I have watched several C++ tutorials on Pluralsight using VS2017 and whenever the author types a pair of braces and presses enter, the cursor always appears indented and on the middle line, ready for typing to commence (see image 2). In my VS2017 however, the cursor always appears in front of the closing brace (see image 1), so I have to press enter to create a blank line between the braces, move the cursor up and then type a tab before I can start typing.

I have searched the settings in VS2017 under text editor/C++ but cannot find how to change this behaviour. It's annoying and I'm thinking there must be a way to change it.

Does anyone know how please?

Braces

Upvotes: 0

Views: 904

Answers (1)

Joe
Joe

Reputation: 6796

Tools >> Options >> Text Editor >> C++ >> Formatting >> General

Be sure that "Automatically format braces when they are automatically completed" is checked.

That should give you what you want

Upvotes: 3

Related Questions