[MonoDevelop] Re: Reformat source file

Jacob Ilsø Christensen jacobilsoe at gmail.com
Fri Jun 10 11:12:54 EDT 2005


Hi.

I am starting out with just coding reformat file. Then I will do the
other stuff.
I have run into an issue though.

Suppose you have the following:

1: namespace NS
2:    {
3: 
4:                    }

This should be (depending on how you have configured MD) formatted to:

1: namespace NS
2: {
3:         
4: }

The problem is that the AST only contains information about where a
namespace declaration begins and ends (lines 1 and 4) not where the
contents of it begins and ends (line 2 and 4).

I would like to extend the NamespaceDeclaration class with this
information. But this class resides in the ICSharpCode.SharpRefactory
namespace. Is it ok to change stuff there or is there still some
collaboration going on with ShardDevelop?

/Jacob



On 6/9/05, John Luke <john.luke at gmail.com> wrote:
> 
> Jacob Ilsø Christensen wrote:
> 
> >Hi.
> >
> >Ok, here is what I plan to do:
> >
> >1) Parse the file currently viewing.
> >2) Traverse the built AST in parallel with traversing the file.
> >3) Indent a specific line according to what level and what item is
> >currently looked at in the AST.
> >
> >Does this sound like a way to do it?
> >
> It sounds like _a_ way, but there are many.  You might want to take a
> look at one of the editors that does
> this already vim, emacs, eclipse, etc.  Have you looked at the existing
> FormattingStrategy stuff in the various language bindings?
> Also, consider multiline pasting and probably more little corner cases I
> can't think of right now.
> 
> >Do we want such a feature in MD?
> >
> >
> I think we do.  Perhaps starting with "format a file on ctl+shift+f" and
> make sure it works right (without changing/losing information) would be
> a smaller first step.  Then format as you go can come later after you
> know all the issues.
>


More information about the Monodevelop-list mailing list