Lex Podgorny Lex Podgorny - 1 year ago 96
C# Question

Xamarin Community Studio: Annoying auto–indentation

How do I disable auto-indentation feature/bug? (Xamarin 6.11, Mac)

  • Note: <CURSOR HERE> designates position of cursor and not actual code.

Here are my steps:

  1. I place my cursor as shown:

enter image description here

  1. I press ENTER:

enter image description here

  1. I type my declaration and jump to beginning hoping to fix indentation:

enter image description here

  1. I press BACKSPACE:

enter image description here

Pressing ENTER again at this point brings me back to step 3.

Please help, it's driving me nuts!

Oh yes, changing indentation in Preferences->Code Formatting->C# ... does not affect the behavior, even with restart.

Answer Source

See: https://forums.xamarin.com/discussion/2509/incorrect-auto-formatting-of-c-code-for-specific-functions

Look down to where it says Text Editor -> Behavior. There is an option named "Enable on the fly code formatting"; You may want to disable this if you wish to format your own codes.

There is also the Smart Indentation mode in Behavior you might want to turn off.