There's another cool thing we now present in SharpDevelop 5: A configurable code formatting engine.
The first that you see for from this feature is the new "Reformat" command in editor's context menu:
You can select a block of code and reformat it. If you don't select anything, whole file will be reformatted.
Define your rules
Of course, you may change the way how SD formats your code. The formatting options used generally for your SD installation can be set in options dialog through "Coding" -> "C#" -> "Formatting":
All available settings are organized in expandable groups. At the top you see a preset selection. Presets are predefined profiles for some common coding styles.
To overwrite your current formatting settings with a preset, just select one and click on "Reset to:".
Define solution's rules
One main advantage is the policy system, which allows to not only set global settings, but also define settings which are specific to a certain solution. There's a new entry in every solution file's properties:
Clicking on the "..." button opens the solution's formatting settings dialog:
Initially all settings are set to "(global)", which means they use the same values as defined in global settings. That way you can override some of the settings specifically for your solution.
All solution-specific formatting settings are saved in a <SolutionName>.sln.sdsettings file, which can be added to version control like the solution itself.
Define project's rules
What you just have seen for solutions is also possible on project level: The project settings now have a "Code Formatting" tab:
Initially all settings are set to "(solution)" here, so they inherit what has been defined in solution (which on the other hand can refer to global options). All project-specific formatting rules you set here will be saved along with the project (in a .csproj.sdsettings file) and submitted to version control.