Brace Completer does exactly what the name says. When you type an opening curly brace and press enter, it automatically fills in the closing brace for you. Microsoft'sProductivity Power Tools extension also brace completion, which works well and supports a number of features that my extension does not. Unfortunately, it doesn't work in VS 2012, so I am once again maintaining this extension. LanguagesBrace Completer works in C#, C/C++, JScript, JavaScript, TypeScript, CSS, and plain text files, and it can be activated/deactivated on a per-language basis from the options page underEnvironment > Brace Completion. Brace completion can also be activated in other file types, but as Visual Studio indents some languages slightly differently, Brace Completer may not indent these correctly. FormattingBrace Completer will automatically adjust to your C# indentation settings. (unless you indent braces but not block contents, but who indents their code backwards?) Note: If you change your C# indentation settings while C# code windows are open, you will need to open the Environment > Brace Completion options page before closing the options dialog. Otherwise, currently open C# files will not be updated and you may get some strange indentation behavior. Also note that Brace Complete may not indent braces properly if you put them where they don't belong (i.e. the braces would generate a syntax error). Brace Completer will also adjust to your C++ indentation settings, but since Visual Studio refuses to let me see these settings, there is a C++ indentation option in the Environment > Brace Completion options page. Change it to match your settings in Text Editor > C/C++ > Formatting. Brace Completer doesn't care if you put your opening braces on a new line or not. It will work either way! UsageSimply type an opening brace, then press Enter. Brace Completer will place a closing brace on the line after the caret and apply the proper indentation. Changelog1.6Added support for TypeScript Fixed another JavaScript indentation bug. 1.5.6Fixed indentation of JSON objects used as function arguments in JavaScript. Fixed a bug where Ctrl+S and other shortcuts were interpeted as Backspace (thanks to Oleg Grytsynevych). 1.5.3Fixed indentation in CSS for VS 2012 1.5.2Fixed indentation of code blocks inside anonymous functions and try blocks for JavaScript in VS 2012 1.5Fixed indentation of closing braces for JavaScript in VS 2012 1.4.2Fixed a crash caused by naively assuming that anything VS reports as a typed character will fit into a char. This means VS won't crash every time you use your mouse's forward/back buttons any more. 1.4.2 fixes the part where fixing things for the mouse buttons broke everything else. 1.4Added an option to use Visual Studio's smart formatting for C#. If you turn this on, the braces will automatically be formatted according to your newline, indentation and whitespace settings when writing C#. I couldn't get this working with other languages. 1.3Added option to add a closing brace immediately after typing an opening brace. With this active, after you type {, press Enter for the regular behavior, or keep typing to keep the code block on the same line. 1.2Fixed settings being reset upon opening the options menu. 1.1Improved the options menu. It now gets the list of extra languages directly from Visual Studio and uses check boxes for all options. Fixed a bug where typing an opening brace, pressing backspace, and pressing enter would trigger a brace completion.
Brace Completer is open source, and you can find the source at https://github.com/ChaosinaCan/BraceCompleter Please post in the Q and A section if you have questions, suggestions, or bugs to report! If you are reporting an issue, please state which language(s) the problem occurs with. |