[MonoDevelop] i want to contribute

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Dec 4 12:56:45 EST 2007


On Dec 4, 2007 12:22 PM, Ploscariu Simion <simion314 at yahoo.com> wrote:
> hi, i read the TODO list and i found this task:
> Refactory Operation: Move class to its own file, i
> want to work on this but i need your help:i do not
> want to make a good for nothing code or some bad
> design code. My ideea is to read the file line by line
> and search for class keyword(that is not in a comment
> )and then to count the { and find where the class
> ends. Of course i must search for possible attributes.
> I want to ask you if this is a good approach, or it
> can be done in other way. For integretion in
> monodevelop i will need your guide.

Actually, all refactoring operations in MonoDevelop are implemented in
a language-independent way, even though only C# is currently
supported. I suggest looking in
Core/src/MonoDevelop.Projects/MonoDevelop.Projects.CodeGeneration.

You can use the MD parser to get the start and end locations of the
class. After that, it's a bit more challenging, as you'd have to
handle namespaces and "using" statements. One way might be to generate
a new class with a temporary name (in order to get a file with
headers, namespace etc, then overwrite it with the class you want too
move. Another way would be to duplicate the entire source file, and
delete the class from one copy and all the other members from the
other copy.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list