GeekyGuy83
GeekyGuy83

Reputation: 107

Visual Studio C++ "Automatically format completed block on }"

Visual Studio has this setting for C#, but I can't find it for C++. "Automatically format completed block on }" I used this feature a lot while working on C# stuff & now that I'm back on C++ (which I prefer), I miss the feature. How can I set this up? I assume I'd have to use a 3rd party plugin or something at this point, but I can't find any relevant ones in all my searching.

What the feature does: If I have a section of code & type '{' before it, then type '}' after it, it will automatically tab it in to match the tabbing rules that make the code easier to read.

Ex:

Start off with some code:

{
    int i = 1;
    int j = 2;
    j += i;
}

Add a start bracket somewhere:

{
    int i = 1;
    int j = 2;
    {
    j += i;
}

Add an end-bracket, and the contained code is automatically tabbed in for me:

{
    int i = 1;
    int j = 2;
    {
        j += i;
    }
}

Upvotes: 4

Views: 500

Answers (1)

user2746401
user2746401

Reputation: 3406

This is in Visual Studio 2013. Make sure you have it enabled in Options under Text Editor->C/C++->Formatting->General. The option is "Automatically format block when I type a }".

Upvotes: 2

Related Questions