Xamarin studio - formatting issues after selecting "Sync with MonoDevelop Project"

I’ve set Xamarin up as my default script editor and selected “Synch with MonoDevelop Project” to enable Unity-specific autocompletion. But after doing this, Xamarin starts adding an extra tab to my code. For example:

public class myClass : MonoBehaviour {
		public GameObject player;

… instead of:

public class hpUpdate : MonoBehaviour {
	public GameObject player;

Everything still seems to runs fine, but it is jarring and makes the code look odd.

Is there a way to fix this?

Thanks!

Similar thing happening to me! Anyone have a fix for this?

For example if I have this code:

	void Update () 
	{
		_commandQueue.DoUpdate();
	}

Then I hit enter after DoUpdate(); and start typing I get:

	void Update () 
	{
		_commandQueue.DoUpdate();
				_commandQueue.End();
	}

Frustrating!

UPDATE: This is caused by Unity’s .sln file setting the “text” tab size to 8. There are two ways to fix this:

  1. Use tab size 8 for everything.
  2. Every time you make a change that modifies the SLN, right click the solution in Xamarin, hit “Options”, “Code Formatting”, “Text File”, and set “Indent Width” to 4.

Until Unity fixes this (ie, stop exporting the .sln with indent width overrides) there’s not a great solution.

1 Like

Thanks for posting the solution. This annoyed the sh*t out of me. Hope Unity fixes it at some point

THIS IS BY FAR THE WORST CODE EDITING PROGRAM I HAVE EVER USED.
I cannot believe the issues that I have with Xamarin Studio.
–commented code being flagged with syntax errors. WTF?
–commented code not greyed out
–intellisense not finding member names until 30 seconds after they have been created
–errors with basic indentations
–hundreds of unnecessary “suggestions” made by the editor:
int x = this.y; //Warning: ‘this’ is redundant, and can be removed safely.
Well, do they not understand the reasons why people use “this”? Its for the intellisense

the program cant handle copy and paste text from external programs
the program starts up in Japanese characters after a crash

I had this problem some time ago but it went away for months.
What I did: review tab settings both in Solution (under Project menu) AND general Mono preferences and set same settings (search under Source Code / Code Formatting / C# source code)

1 Like

Try inserting this into your code and watch Xamarin no longer be able to handle brackets or parenthesis indentation:

string g=(“"Hello"”);

it screws up the entire editor