How can I get Visual Studio 2008 to align my assignment operators?

Posted by Alison R. on Super User See other posts from Super User or by Alison R.
Published on 2010-02-11T22:24:45Z Indexed on 2012/12/16 11:10 UTC
Read the original article Hit count: 254

I had this in Vim and miss it dearly now that I'm confined to Visual Studio. I'd like to take this:

MyType type_obj = new MyType();
MyLongerType longer_type_obj = new LongerType()

To this:

MyType     type_obj        = new MyType();
LongerType longer_type_obj = new LongerType()

I have found some macros for this on the web, but they seem to be for an older version of Visual Studio (< 2008). Here is one from 2000.

Edit:

Further digging in Google turned up this one: http://www.omegacoder.com/?p=8

It seems to work to align equals signs, but I haven't yet figured out if it can align the local variable names, too.

Still no clue as to whether I could just get it to perform this sort of behavior with a Ctrl E+D, although that might not be practical considering how it works. (It aligns going down from the line which currently has focus.)

© Super User or respective owner

Related posts about formatting

Related posts about visual-studio-2008