I am using auto formatting by default for all documents, but some parts of code are more readable if they are left in column mode (like this one below).
switch (itUnit)
{
case ItUnit.NotApplicable: return -1;
case ItUnit.KilometersPerHour: return 1;
case ItUnit.MetricTons: return 1;
case ItUnit.Centimeter: return 0.01f;
I don't want to stop auto formatting files with column mode style function or two. I am searching for some option to help me with this. Maybe something like EditorGuidelines but that auto format does not ignore them (like it ignores the version I linked). Or some option to mark some parts of code to be ignored by formatter. Or maybe some third party formatter that supports guidelines?
Auto-format will make this:
switch (itUnit)
{
case ItUnit.NotApplicable: return -1;
case ItUnit.KilometersPerHour: return 1;
case ItUnit.MetricTons: return 1;
case ItUnit.Centimeter: return 0.01f;
Often you can use Undo (ctrl-z) to undo the autoformat change, in particular after pasting a column-aligned line of code. Not ideal, but could help.
Also Tools/Options/C#/Code Style/Formating/Spacing, check "Ignore spaces in declaration statements" can help too.
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