Monodevelop issues with opening curly brackets

Whenever I create a new method, for loop, if statement and I use the tab auto complete the curly bracket indentation isn’t how I want it as I follow a specific indentation format. But Monodevelop places the opening curly racket at the end of the loop/etc, instead on the next line. This is fine I am familiar with this behaviour with pretty much all compilers and the solution is to just make a pass of the code from time to time or immediately, and place the cursor before the opening curly bracket and hit enter. A minor annoyance but I have grown to live with it.
But in Monodevelop it seems to “insist” that its indentation MUST be enforced and it will move my cursor to the next line and leaves the bracket where it is. Usually it only does this the first time I try and I have to do the same thing twice every time I try and fix my indentation. This is infuriatingly frustrating enough to do a lengthy search on google and finally resort to taking the time to write a long winded question describing the issue.

It gets worse when on occasion I have to do this 4 or 5 times in a row for a single bracket or when accidentally removing an open bracket and replacing it or other action that calls for autoformat to kick in and it re formats that open bracket to the end of the line above.

Does anyone else suffer from this issue or have a solution that doesn’t involve turning off the autocomplete/format options?

2 Answers

2

In MonoDevelop try

Project - Solution Options - Code Formatting - C# Source Code

Then set Policy to Microsoft Visual Studio.

It’s not as fussy about jumping the open curly back up to the function or if line ending.

Thanks I'll try that. If it was only pushing it back up I could hit ctrl+z but it seems to preempt the action and just move the cursor down. Also notable by the lack of an actual new line being created. I'll post back in a minute.

No it still does it. I'll close and re open the whole program, unity and all see if that reloads the policy.

I switched off of MonoDevelop because of its autocomplete settings. I don’t think you can change them.

You should use VisualStudio Community instead → it comes preinstalled with Unity for VS Tools and links to your current Unity Editor runtime.

VS will allow you to change your coding conventions in the text editor options.

I use VS for programming the Game libraries that don't require Unity and due to an issue last year with installing and uninstalling VS software I had over 2.5million lines of code get wiped on me. (I know I should have had source backups. It's complicated alright) As a result of that I am certain;y not installing anything else to do with VS other than VS itself. Still rebuilding that code today.