[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Refactoring idea
|
Hi Alec
What you describe is actually already there in CDT and is called "toggle
function". Take your example bellow and call toggle-function from the
refactoring menu (or with shift+alt+t) while the caret and you will get
what you are looking for. Call it again and the definition of "f" will
be moved to a source file (A.cpp if the class definiton is in A.h).
enjoy using it!
Lukas
Am 26.11.2013 23:50, schrieb Alec Teal:
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
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev