简体   繁体   中英

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.

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.

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 例

Hope it helps.

Bye.

格式文档Ctrl + K,D的快捷方式

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM