[MonoDevelop] New code formatter joins line to aggressively

Oskar Berggren oskar.berggren at gmail.com
Thu Sep 17 15:47:25 EDT 2009


For the archives:
https://bugzilla.novell.com/show_bug.cgi?id=540052 (about joining lines)
https://bugzilla.novell.com/show_bug.cgi?id=540043 (using-statements)
https://bugzilla.novell.com/show_bug.cgi?id=540044 (comment rewrapping)

/Oskar


2009/9/16 Michael Hutchinson <m.j.hutchinson at gmail.com>:
> On Tue, Sep 15, 2009 at 10:50 AM, Oskar Berggren
> <oskar.berggren at gmail.com> wrote:
>> Hi again, sorry for late reply.
>>
>> From the previous mails in this thread I get the impression that the
>> document formatter and the on-the-fly formatter are separate? Use
>> separate implementations of the algorithms? If I want to study the
>> implementation, where would I start?
>
> They're the same AFAIK. The "smart indenter" (indents the new line
> when you press enter) is separate though.
>
> main/src/addins/CSharpBinding/Parser/CSharpFormatter.cs
>
>> I agree that automatically wrapping overly long lines is probably not
>> doable in a reasonable way. If experiments are done to implement this,
>> it must surely be made optional at runtime, probably with default off.
>
> Yes, I agree.
>
>> Wrapping comment blocks might be a different thing. I've used a very
>> helpful visual studio extension that does this. Is something similar
>> available for MD? I do believe this should be separate from the code
>> formatter, so that the comment wrapper can be invoked manually on a
>> specific comment block.
>
> That sounds like it could be useful.
>
>> Another suggestion:
>> Currently, in MD 2.2 beta 1 (with brace-on-new line)
>> using (IDisposable a = null)
>>    using (IDisposable b = null)
>>    {
>>        int c;
>>    }
>>
>> For the case of several using statements in sequence, a certain other
>> IDE seems to have an exception so that this is instead formatted:
>> using (IDisposable a = null)
>> using (IDisposable b = null)
>> {
>>    int c;
>> }
>>
>> In my opinion this is much nicer in that it doesn't waste so much
>> horizontal screen space, especially when having three or more
>> using-statements.
>>
>> The rule would be, I suppose: If the child of a using-statement is
>> another using-statement (with no intervening opening brace), then
>> don't indent the child.
>
> That sounds like it should be a code style option.
>
> Could you file enhancement bugs for these? Thanks!
>
> --
> Michael Hutchinson
> http://mjhutchinson.com
>


More information about the Monodevelop-list mailing list