Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio auto-indent for variable assignments

I know VS could do that, but i can't remember the operation name nor the shortcut for it...

Visual studio does the following:

Before:

string a = "bliblablubb";
string ab = "bliblablubb";
string abc = "bliblablubb";
string abcd = "bliblablubb";

After:

string a    = "bliblablubb";
string ab   = "bliblablubb";
string abc  = "bliblablubb";
string abcd = "bliblablubb";

I am currently using VS2013 preview.

like image 402
Nefarion Avatar asked Aug 08 '13 10:08

Nefarion


2 Answers

You can install the Productivity Power Tools extension and press CTRL+ALT+] (see the Align Assignments section on that page). (Edit - doesn't seem to support VS2013 preview but I'll leave it here for others who are using 2010/2012).

Alternatively, you could try using the Code alignment extension. This claims to support VS2013.

Both options require a non-express edition of Visual Studio as express editions don't support extensions.

like image 187
keyboardP Avatar answered Oct 18 '22 05:10

keyboardP


I use productivity tools, they provide the following shortcut (Ctrl+Al+ special character) because I'm using spanish layout the character I see is ¡, but for example in german is ´ ... so better you install the extension and you will see the one that works for your example

Hope it helps.

Bye.

like image 32
blfuentes Avatar answered Oct 18 '22 06:10

blfuentes