Is there a setting to have MonoDevelop not insert an automatic whitespace between a function call and the round brackets? It automatically formats to this:
private void Foo () {}
Foo ();
But I want this:
private void Foo() {}
Foo();
Is there a setting to have MonoDevelop not insert an automatic whitespace between a function call and the round brackets? It automatically formats to this:
private void Foo () {}
Foo ();
But I want this:
private void Foo() {}
Foo();
In mono go to
[Project]->[Assembly C# Options] → [Source Code] → [Code Formatting] →
[C# Source Code] → Change [Policy] to Mono , then Click the “C# Format” tab, and mess with the settings in there. That’s where you can set the indentations etc for all that stuff.
I just now went in there a couple of minutes ago and found that. Mine was set to “Inherited Policy” and none of the parenthesis brackets spacing like you mention above happened on mine at all.
Just to clarify something.
If you’ve already started a project, which you would have or you wouldn’t be in MonoDevelop cursing at all the white space, then the Per Project settings will override the main Preferences.
So you basically have to change it in both places. I started with Preferences->Source Code and was super frustrated that it didn’t seem to effect my open files. Then looking here I found out that there is also the same setting under Project->Assembly C# Options.
Probably on the next project it would just inherit from the preferences. But to get it to be correct on this project I had to change it in both places.
The answer loonuhtik gave is correct for per-project settings, but to do it in a global way that will apply to new projects there’s the exact same settings dialog under Preferences->Source Code.
The problem comes from Unity. In fact it re-generates the solution with the default policy.
I use a workaround that overwrites the contents of the solution. I based on the following link : Stick this in an Editor folder in your project. Every time the solution file is recreated by Unity it will remove all the cruft that Unity injects into the file. Hopefully, one day, Unity will actually fix this on their end. · GitHub
I just found another one that supports mac : PostProcessor for MonoDevelop project files in Unity · GitHub
Good luck,
Xentor