Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Refactoring idea

Hey all,

A really simple yet really useful refactoring to offer would be to pull method definitions out of a class and stick them somewhere else (to clipboard for example).

How many times have you accidentally defined methods while writing the class, I'd love to just highlight a block and have it leave the declarations and put something I can just copy and paste into the code file for me. It'd be great if it could also remove variable names.

Example:

class A {
    U f(V x) {
        /*blah*/
    }
};

To:
class A {
    U f(V);
};

With:

U A::f(V x) {
    /*blah*/
}

On the clipboard (or something)

I think it'd be easy enough to do. Carry forward any surrounding tokens provided it's not "virtual" and such. Even constructor initialiser lists wouldn't be a problem.

I suggest this because it's a task could (almost) be accomplished by little more than a regex rule. It'd save me a lot of time.

Alec


Back to the top