I am using Visual Studio 2010 and have statements that look like this:
a = 1;
ab = 12;
abc = 123;
etc...
which I would very much like to turn into this:
a = 1;
ab = 12;
abc = 123;
etc...
without Visual Studio then turning them back to to the first example when ending the statement with a semi-colon or Pressing Ctrl-K + F (Format selected lines).
I have checked the box Tools->Options->Text Editor->C#->Formatting->Spacing->"Ignore spaces in declaration statements" but it doesn't help. It only helps for real declaration when I am creating a new variable. That is, it works on the following block:
int a = 1;
int ab = 12;
int abc = 123;
etc...
But I really (also) need an option "Ignore spaces in assignment statements". How do a I do that? I have tried to install "Align Assignment" (https://visualstudiogallery.msdn.microsoft.com/0cc34d69-c6f1-41e3-ac6e-5de071b3edc8) and sure enough, it aligns the rows, but then Visual Studio de-aligns them automatically when formatting the text file or editing the rows.
This was answered in a duplicate question that is linked above. I have verified that it works. The important missing part is the operator option. Since I can't comment and vote, here is the solution copied from viktorcpp:
Tools|Options|C#|Formatting
I. Ignore spaces in declaration statements <<-- check this
AND
II. Set spacing for operators Insert space... Ignore spaces ... <<-- check this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With