KulaGGin KulaGGin - 1 year ago 110
C# Question

How to automatically move opening bracket on a new line and add closing curly bracket in Visual Studio 2015?

Meet long time reader, first time poster :P

At the moment I have to manually type opening curly bracket, then closing curly bracket and only after that IDE will format curly brackets as I want, it will put curly brackets on a new lines:


What I want is when I type opening curly bracket and then press enter, I want IDE to automatically put opening curly bracket on a new line, then add empty line, then add closing curly bracket and focus on empty line in the end.

I don't want it to do all of that when I put opening curly bracket and then type some text afterwards(when I initialize class, for example).

I don't want any other automatic completion of other characters(quotes, parentheses, etc.)

My settings atm:


Looks like I can't achieve what I want using default VS settings.

When I check "Automatic brace competion" it starts to automatically complete quotes and parentheses, which is really annoying because I have to switch to arrows or mouse all the time to move cursor to a proper position, so I can continue to enter code.

Is there some extension for Visual Studio to achieve what I want? I tried productivity power tools so far and couldn't achieve it either:


Thanks in advance!

Ryu Ryu
Answer Source

You can try ReSharper(30 days free trial) or Code maid extension which is really good at reorganizing code (http://www.codemaid.net/)

This may also help

How to use Visual Studio automatic brace completion to surround an existing block?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download