Monodevelop 4.0.1 (Unity 4.3) code folding bug?

Just updated to Unity 4.3, which comes with MD 4.0.1. Every time I save (menu or ctrl+s) in MD, the code folding in MD breaks. In some cases it just thinks everything is one big block, in others it thinks everything apart from /// lines are not foldable. Anyone else getting this?

A temporary workaround: having saved a file, switch to another open tab in MonoDevelop, switch back to the tab of the file you just saved, wait a second and it should recalculate all the folding buttons.

Another thing I noticed is every time I save the cursor jumps to line 1. This could get annoying for someone who is thousands of lines in code.

So I have reverted to using the old mono develop. Just do a duel install of Unity (Install Unity 4.2, rename its folder to something like “Unity 4.2”, then install Unity 4.3) and then set your script editor in the Unity preferences window to the old mono. Life is a lot happier now :slight_smile:

I simply disabled code folding since I don’t really care about it that much. It solved the problem of the cursor jumping to line 1 also.

In Mono Develop, go to the “Tools” menu, select “Options…”, find the “text editor” section, select “general”, then uncheck all three of the code folding options.

If you do need code-folding, I would recommend using

#region regionname //(or simply give function name)
void function(){
...
}
#endregion

This solves the problem of unfolding while saving.

Not necessarily an answer for Monodevelop, but if you install http://xamarin.com/, it’s basically Monodevelop without these weird bugs but without the ability to debug.

Wow, this is pretty crippling. i’ve just started usibng code folding for the first time and this is horrible.

we’re on unity 4.5 now, why is it not fixed?

I figured it out!!!

Go to tools, options, general, code folding.

Check fold# regions by default!!!

Hallelujah!!