Search code examples
c#xamarinmonodevelopxamarin-studio

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.


Solution

  • 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.