I'm looking for a way to get more possiblities of formatting code with C# in Visual Studio 2017, and after days of googling I felt like this seems to be the place where I can find my answer.
Features we're looking for is putting code assingments into a block, so that e.g.
public Foo(string name, string adress, int numberOfBooksOwned)
{
Name = name;
Adress = adress;
NumberOfBooksOwned = numberOfBooksOwned;
}
becomes
public Foo(string name, string adress, int numberOfBooksOwned)
{
Name = name;
Adress = adress;
NumberOfBooksOwned = numberOfBooksOwned;
}
It should also give the ability to override all of the formatting possibilities Visual Studio provides and save them into any kind of file, so that other members of my team can use those settings as well.
I'm aware that VS 2017 added a new kind of code formatting, but if I got that right, the added support for EditorConfig does not do what I need.
I also tried CodeMaid, but this seems to require much performance, and I also think it does not match my needs.
Does anyone know about something that fits the above description, Preferably some kind of extensions that is compatible with Visual Studio 2017 or something built in since the latest version, to make it easy for anyone to use.
Thanks in advance,
Markus
I believe I accidentally stumbled on an answer for you. Microsoft added this to the Productivity PowerTools for VS2017. https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.AlignAssignments allows you to do exactly what your example shows by pressing Ctrl+Alt+]
Please make sure you take note of the one comment in the page:
Note! This may conflict with your formatting settings. E.g. in C# you will need to disable: Tools->Options->Text Editor->C#->Formatting->Spacing->"Ignore spaces in declaration statements"
Considering this is an extension added by Microsoft I guess it's safe to say this feature is not built into VS2017.
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