KulaGGin KulaGGin - 7 days ago 5
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:

http://i.imgur.com/19FWufk.gif

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:

http://i.imgur.com/JwH1mSx.png
http://i.imgur.com/Ts3puFV.png
http://i.imgur.com/oolzFor.png
http://i.imgur.com/Nozl1aC.png


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:

https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProductivityPowerTools


Thanks in advance!

Ryu Ryu
Answer

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?

Comments