[MonoDevelop] Formatting text: change pasted / open document formatting?
IBBoard
ibboard at gmail.com
Sat Dec 18 15:57:14 EST 2010
On 18/12/10 20:48, Dotan Cohen wrote:
> Hi all, Monodevelop newbie here. When opening Visual C# code in
> Monodevelop 2.4 in Kubuntu 10.10 (yes, I know that I cannot build
> Visual C# in this environment), the code formatting is displayed
> exactly how the file was written, not as I have set my preferences for
> in Edit -> Default Policies. I have looked everywhere for an option to
> reformat on open/paste but I cannot find such an option. Does this
> option exist, or should I file a feature request? Visual Studio has
> this terrific feature and it allows coders with differing indentation
> preferences to work on file together comfortably (we normalise for
> diffs).
>
> Thanks.
>
You can manually format, and you can format on save (the latest Git
version has an option in Preferences under Behaviour), but I think I had
to argue for the latter to be added. Some people thought that it was bad
behaviour because it meant that code changed in ways that they might not
see (e.g. closing with unsaved changes and hitting "save" when
prompted), but I wanted it for roughly the same reason as you.
Different indentation preferences in terms of how many spaces a tab is
should be supported, but anything for the other formatting options needs
an action to make it happen.
Normalising on commit is an interesting idea, though. Every project I've
worked on just goes for "all code must be formatted like this, which
we'll do by having people use the same format rules". Generally it
doesn't cause much of a problem. We've said in the team that saving some
abstract model of the code (like the compile tree) and formatting the
code as the developer wants would solve all of these "whitespace and
formatting changes" commits, but no-one seems to do it at the moment.
I'm not sure why you wouldn't be able to build C# in Kubuntu, though. As
long as you've got MD and all of the appropriate Mono dependencies then
you should be able to build in KDE. There's something really wrong if
you can't, what with MonoDevelop building code on Windows and Mac as
well these days!
Regards,
IBBoard
More information about the Monodevelop-list
mailing list