Aligning @ Equals

Ok, i'll admit when it comes to formatting code, but is there a way to stop VS.NET 2005 from removing the extra spaces i put in to align my code?

When i write:

some.thing = 1;
some.other_thing = 2;

I end up with:

some.thing = 1;
some.other_thing = 2;

Surprisingly annoying

[701 byte] By [a0-0b] at [2007-12-24]
# 1

The formatting options in VS 2005 do not directly support this kind of alignment, but I can offer you a workaround that should prevent VS from removing the extra spaces. Under Tools\Options\Text Editor\C#\Formatting\Spacing, scroll down to the bottom of the options list on the right hand side and look for "Set spacing for operators". If you change this to "Ignore spaces around binary operators" it will prevent VS from fiddling with the extra spaces you are inserting before and/or after "=". Of course, we won't automatically adjust the spacing around other binary operators, either, so there is a downside.

If you like, you can request this feature through http://connect.microsoft.com/VisualStudio/Feedback. By entering your request there, you'll be able to track it and see when (and if) it will make it into VS.

Thanks,
-Tom Meschter
Software Dev, Visual C# IDE

TomMeschterMSFT at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# IDE...
# 2
<quote>If you change this to "Ignore spaces around binary operators" it will prevent VS from fiddling with the extra spaces you are inserting before and/or after "=". Of course, we won't automatically adjust the spacing around other binary operators, either, so there is a downside.</quote>

I tried this, but the following doesn't work. If you type ...

something_else = new object();
something = new object();<hit return here>

and hit return it will remove my white space. Still, not too worried, it seems to help in other places. As far as "automatic" is concerned, i wouldn't really care, as long as it doesn't remove my formatting. But the formatting is just too useful to turn off compeltely.

Thanks for the help.

P.S. is formatting/intellisence accessable as part f the VS extensions? could i code my own formatting engine and integrate it into vs? are there any third party solutions available?

a0-0b at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# IDE...