Search code examples
c++visual-studio-2012matchingcurly-braces

How do I disable brace completion in Visual Studio 2012?


I have recently upgraded to Visual Studio 2012. Whenever I stand on a curly opening bracket and press tab, it automatically inserts 2 new lines and a closing bracket.

{|<- cursor

Pressing tab gives me.

{
    |
}

I wish to disable this behavior. I've searched through the settings, Google and MSDN for the past hour, but I've been unable to find anything that would solve my issue.

I have disabled all installed plugins to see if it would go away, but it didn't.


Solution

  • The behavior you are seeing is being caused by a code snippet. Snippets can be activated by typing the snippet shortcut followed by a tab. Visual Studio 2012 comes with several code snippets pre-installed for several different languages. For the C++ language there a default snippet with a shortcut of { which expands to:

    {
    
    }
    

    The default snippets can't be disabled easily through the default GUI, however you should be able to remove the snippet file which is located at (for English language):

    %VSInstallDir%\VC\Snippets\1033\Visual C++\{.snippet
    

    I believe there are other extensions out there for managing snippets as well.