[MonoDevelop] Refactorer question

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Feb 3 23:20:37 EST 2009


On Fri, Jan 30, 2009 at 1:55 AM, Vadim Chekan <kot.begemot at gmail.com> wrote:
> Hi all,
>
> I'm trying to implement refactoring function "Move class to file" as
> described on TODO page.
> If I understand correctly, there is BaseRefactorer class and its idea
> is that it contains lang-independent logic. Whatever is language
> dependent, must be implemented in appropriate plugin, for example
> CSharpRefactorer.
> If I'm right, then would it be a bug the following code in BaseRefactorer:
>                public IType CreateClass (RefactorerContext ctx, string directory,
> string namspace, CodeTypeDeclaration type)
>                {
>                        CodeCompileUnit unit = new CodeCompileUnit ();
>                        CodeNamespace ns = new CodeNamespace (namspace);
>                        ns.Types.Add (type);
>                        unit.Namespaces.Add (ns);
>
>                        string file = Path.Combine (directory, type.Name + ".cs");
>
> What if we refactor a language different than c#, should extension be
> obtained from appropriate refactorer binding?

The base refactorer does contain some C#-centric implementations, but
these should always be overridable by concrete refactorers for other
languages. This particular limitation does look like a bug, yes.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list