Visual Studio 2013 has been out in preview since Microsoft’s BUILD conference last month. One simple but useful feature that has been added? Whenever you type in an opening parentheses (whether it’s curly or a regular bracket), its matching counterpart is automatically added.
As the Visual Studio blog points out, this option already existed in the Visual Studio Productivity Power Tools add-on, but is now part of the core product. Called ‘Auto Brace Completion’, it is language sensitive, and covers more than parentheses; in C++, for instance, it adds semi-colons for class types.
Hit the blog post for details of some of the other auto-complete features built into Visual Studio 2013, including a handy ‘Peek Definition’ feature for viewing definitions without leaving your code. Right now that’s a view-only feature, but Microsoft says it is working on adding edit options for the final release.
Visual Studio 2013 New Editor Features [Visual Studio Blog]
Comments
7 responses to “How Visual Studio 2013’s Editor Eliminates Parentheses Pain”
Would this actually be useful? Half the time when I’m starting a loop etc its for code I’ve already typed below which I now want in a loop/if etc. I’d have to delete the close bracket it added and put it where I wanted it in the first place. Am I doing it wrong?
this has been on notepad++, sublime, eclipse ports for years if i remember correctly
Yep, and Geany as well
I didn’t realise parentheses were still an issue considering modern IDE’s do half the work for you. Most even take care of syntax for you with predictive text. Besides, finding missing parentheses shouldn’t be too much of an issue if you use proper indentation.
Anyone coding c++ in Visual Studio should really pay for Visual Assist, it does this (which I personally disable because I don’t like it), but also has far superior symbol/definition finding, renaming, etc.
Microsoft’s free VS Productivity Power Tools have offered this for years.
As do most other good addons. eg ReSharper.
As the article states I’ve had the VS PPT taking care of this for years, but more often than not it doesn’t always work well with my coding style (i also end up with extra “s due to it auto inserting them) I’ve come close to disabling it a few times.