MonoDevelop 1.0 doesn't appear to have a code-formatter like Eclipse does for Java. Is there a preferred shell script (or MonoDevelop add-in?) that you've found to work well?
At the moment, source code formatting in MonoDevelop is marked as a future enhancement: https://bugzilla.novell.com/show_bug.cgi?id=321946
In the meantime, you may want to check out Artistic Style for C# formatting: http://astyle.sourceforge.net/
I'm planning to see how this might be wired up as an external tool within MonoDevelop. If I get to that, I will edit my answer with the information. UPDATE: I don't have enough reputation to leave a comment, so I'll make one here: Nice job, Dustin, and patch for MonoDevelop too :-) I wonder how recent the version is that is included with Ubuntu... Either way, I'm glad you found something that works for you.
Thanks, Brandon. I submitted a patch to MonoDevelop. The issue with MonoDevelop add-ins is that there is a mono compiler bug that doesn't handle anonymous delegates correctly. (bug report: https://bugzilla.novell.com/show_bug.cgi?id=394347)
The patch/workaround is to just cast the anonymous delegate to the proper delegate type. (bug report & patch: https://bugzilla.novell.com/show_bug.cgi?id=369538)
I'm running with the patched version now and am able to execute AStyle on the current edited document by simply creating a new External Tool setting with the following settings:
TITLE: A_Style (put in underscore to enable hotkeys) COMMAND: astyle ARGUMENTS: ${ItemPath}
Then, just execute it using Tools->AStyle (or ALT-T, S)
9/25/08 Edit -- I just put up a blog posting on how to patch MonoDevelop 1.0 and get it working with AStyle : http://dustinbreese.blogspot.com/2008/09/auto-formatting-code-in-monodevelop-10.html
It's a nice programming exercise to write your own formatter . I wrote one for C++ , and it was a nice challenge . You could learn a lot by writing it :)